Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
转换并编码一个php文件_Php_Uudecode - Fatal编程技术网

转换并编码一个php文件

转换并编码一个php文件,php,uudecode,Php,Uudecode,我想用uuencode对一个php文件进行编码,以便与之一起使用 eval(gzuncompress(convert_uudecode("somedata"); 我只找到了一种编码字符串的方法,但没有找到编码完整php文件(或php代码)的方法 谢谢 先读取文件 对内容进行编码,然后对其执行任何操作。您只需读取文件的数据即可 $contentString=file\u get\u contents(路径到\u PHP/some.PHP) adn然后执行相同的eval(gzuncompress

我想用uuencode对一个php文件进行编码,以便与之一起使用

eval(gzuncompress(convert_uudecode("somedata");
我只找到了一种编码字符串的方法,但没有找到编码完整php文件(或php代码)的方法

谢谢

先读取文件


对内容进行编码,然后对其执行任何操作。

您只需读取文件的数据即可

$contentString=file\u get\u contents(路径到\u PHP/some.PHP)

adn然后执行相同的
eval(gzuncompress(convert_udecode($contentString))

更新

如果需要将此字符串作为结果

来自您的内容
$phpFileContent=str_replace(数组(“”),“”,$phpFileContent);
//编码与压缩
$phpFileContent=convert_uencode(gzcompress($phpFileContent));
//您的结果字符串

$result='好的,谢谢你,这就是我需要的。我必须压缩和编码字符串吗?我的nneda输出如下:是的,如果您的
some.php
文件包含编码数据,那么您必须通过适当的方式对其进行解码
convert\uudecode
gzuncompress
,然后只将其传递给
eval
file\u get\u contents
只是返回给定路径文件的内容,没有任何解码,但如何首先对数据进行编码?我需要一个类似于顶部示例链接中的输出,例如,
M>)S=6PEOVTBR\u BL90、\x5c2(9D0;W+\x5c%)。Q@UKL;O,7,K.-98!\x24
…我试过使用
文件获取内容
转换编码
,但这给了我一个错误的输出。检查上面更新下的文本在Armen,它像一个charme一样工作。你真漂亮。非常感谢!
// Reading file content
$phpFileContent = file_get_content("PATH/some.php");

// Remove <?php and ?> from your content
$phpFileContent = str_replace(array('<?php', '?>'), '', $phpFileContent);

// Encoding and compressing
$phpFileContent = convert_uuencode(  gzcompress($phpFileContent) );

// Your result string
$result = '<?php eval(gzuncompress(convert_uudecode("' . $phpFileContent . '")));';

//which you can write to some other php file with file_put_contensts
file_put_contents ( 'PATH_TO_RESULT_FILE/result.php' , $result);