我必须解码我命名为cache.log的我的一个Chrome缓存文件的二进制内容数据.我要解码的方式是使用我在这里找到的PHP脚本
http://www.frozax.com/blog/2011/05/recover-file-google-chrome-cache-gzipped/
我已经安装了以下命令的PHP
sudo apt-get install PHP5 libapache2-mod-PHP5 sudo apt-get install PHP5-cgi
当我尝试运行index1.PHP脚本时,我在Terminal中得到以下内容
s3z@s3z-laptop:~/Desktop$PHP index1.PHP PHP Deprecated: Comments starting with '#' are deprecated in /etc/PHP5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0 // cache.log is a copy of chrome cache page with only the file content section $cacheString = file_get_contents("cache.log"); $matches = array(); preg_match_all('/\s[0-9a-f]{2}\s/',$cacheString,$matches); $f = fopen("t.bin","wb"); foreach ($matches[0] as $match) { fwrite($f,chr(hexdec($match))); } fclose($f); ob_start(); readgzfile("t.bin"); $decoded_data=ob_get_clean(); echo $decoded_data;
正如你所看到的,它正在做的是回应脚本.
如何实际运行脚本?
它看起来不像代码包裹在:
原文链接:https://www.f2er.com/php/130544.html<?PHP ?>
如果没有,它将只是回声而不是执行.这样做的原因是PHP可以将服务器脚本和HTML混合在同一个文件中.
<html> <head><title></title></head> <body> <?PHP //Inside the PHP block so it gets executed and prints 'Hello World' echo "Hello,World!"; ?> <!--Outside the PHP block so it just gets echoed and prints 'echo "Hello,World!";' --> echo "Hello,World!"; </body> </html>