问下file_get_contents这个函数? $config没有任何东西,file_get_contents抓取的是HTML,程序源码是不能抓取的,抓取的是源码解析后的内容 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 file_get_contents用来读取一个档案的内容(本地及网络都可以)$config 是存了什么东西? <?php $dbhost = 'localhost'; ......?>类似这样的配置信息 我现在要在后台修改这些配置信息 应该怎么整啊! $config应该改成配置档案的路径 $config 现在就是配置文件的路径? 哪要看你$config这个配置文件是如何写的.string(86) 说明,还是取到文件内容了,长度为86.查看右键能看到源码,如果字符串非空的话. 例子:<?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $dbname = 'test';?>这是config.php 文件$sitefile = dirname(__FILE__)."/config.php";$content = file_get_contents($sitefile);我就这个意思!我就是想得到这个源文件 例如有个表单 直接修改表单 就可以更改配置文件里的选项! echo $sitefile = dirname(__FILE__)."/config.php"; $content = file_get_contents($sitefile);echo "<pre>".htmlspecialchars($content)."</pre>";已经成功取得了,浏览器隐藏了而已 <?php$dbconnect_file = file_get_contents("./dbconnect.php");echo $dbconnect_file;?>dbconnect.php代码如下:<?phpob_start(); mysql_connect("localhost", "root", "");mysql_query("set names 'gb2312'");if(!@mysql_select_db("zrpg")){ header("location:install.php"); exit;}if(isset($_COOKIE[username]))$username = $_COOKIE[username];else$username = GetIP();header('Content-Type:text/html;charset=GB2312');?>经测试,可以抓取到,查看页面源代码可以看到内容. 只要路径正确,就肯定能获取到,要看是否查看到,就要看HTML源代码。 直接include就可以了,为啥还要file_get_contents呢.呵呵. 呵呵,没看清楚哦。楼主不是像include,而是想修改里面的配置,看8楼的。哈哈 PHP 生成XML 去掉 表格 只留下文字 PHP中数据库备份文件名问题,请高手指教,不胜感激 求助discuz 7.0首页调用 这个正则表达式该怎么写?谢谢指点! 字符串中提取数字 下载远程文件? 满意的就加100分. 关于php的疑问g 怎么让交换显示的图片能同时显示文字介绍 php问题,急 php+xml+xslt PHP5中运行正常,但空间版本为PHP4,谁能帮我转换一下! PHP怎么做下载,不好意思刚才问了结果不行 不得不BS一下!
用来读取一个档案的内容(本地及网络都可以)$config 是存了什么东西?
$dbhost = 'localhost';
......
?>
类似这样的配置信息 我现在要在后台修改这些配置信息 应该怎么整啊!
查看右键能看到源码,如果字符串非空的话.
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$dbname = 'test';
?>这是config.php 文件$sitefile = dirname(__FILE__)."/config.php";$content = file_get_contents($sitefile);
我就这个意思!我就是想得到这个源文件 例如有个表单 直接修改表单 就可以更改配置文件里的选项!
$content = file_get_contents($sitefile);
echo "<pre>".htmlspecialchars($content)."</pre>";已经成功取得了,浏览器隐藏了而已
$dbconnect_file = file_get_contents("./dbconnect.php");
echo $dbconnect_file;
?>
dbconnect.php代码如下:<?php
ob_start();
mysql_connect("localhost", "root", "");
mysql_query("set names 'gb2312'");
if(!@mysql_select_db("zrpg"))
{
header("location:install.php");
exit;
}
if(isset($_COOKIE[username]))
$username = $_COOKIE[username];
else
$username = GetIP();header('Content-Type:text/html;charset=GB2312');
?>经测试,可以抓取到,查看页面源代码可以看到内容.
只要路径正确,就肯定能获取到,要看是否查看到,就要看HTML源代码。
呵呵.
呵呵,没看清楚哦。
楼主不是像include,而是想修改里面的配置,看8楼的。
哈哈