file_get_contents( ) 函数,读取”.php”结尾文件,会注释部分代码 解决方法

事情是这样的,回顾:

/test.php

$file_path =  './test.php';
        $site_conf =file_get_contents($dbconfig_path);
        echo '<pre>';
        print_r($site_conf);exit;

file_get_contents( ) 函数,读取".php"结尾文件,会注释部分代码

 

解决办法

需要htmlentities( )将其作为实体输出;

 $file_path =  './test.php';
        $site_conf = htmlentities( file_get_contents($dbconfig_path) ); 
        echo '<pre>';
        print_r($site_conf);exit;

file_get_contents( ) 函数,读取".php"结尾文件,会注释部分代码

 

    A+
发布日期:2020年02月14日 13:03:03  所属分类:PHP
最后更新时间:2020-02-14 13:03:03
头像
  • ¥ 99.0元
  • 市场价:199.0元
  • ¥ 189.0元
  • 市场价:269.0元
  • ¥ 68.0元
  • 市场价:98.0元
  • ¥ 398.0元
  • 市场价:498.0元

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: