【发布时间】:2011-11-26 19:52:47
【问题描述】:
我必须解码我命名为 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 脚本时,我在终端中得到以下信息
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;
如您所见,它所做的只是回显脚本。
如何实际运行脚本?
【问题讨论】:
-
看起来像 PHP 的东西实际上是输出的,纯文本。检查文件的语法并确保您的代码包含在
<?php ... ?>标记中。请阅读有关 PHP 基本语法的手册:php.net/manual/en/language.basic-syntax.php