PHP   发布时间:2022-04-09  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了当我在Ubunutu中运行一个.php脚本时,怎么来只是回到脚本呢?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我必须解码我命名为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;

正如你所看到的,它正在做的是回应脚本.

如何实际运行脚本?

它看起来不像代码包裹在:
<?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>

大佬总结

以上是大佬教程为你收集整理的当我在Ubunutu中运行一个.php脚本时,怎么来只是回到脚本呢?全部内容,希望文章能够帮你解决当我在Ubunutu中运行一个.php脚本时,怎么来只是回到脚本呢?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。