Heim  >  Artikel  >  Backend-Entwicklung  >  php调用本地php文件问题

php调用本地php文件问题

WBOY
WBOYOriginal
2016-06-23 14:20:301176Durchsuche

我有一个php文件,要循环一个数组构造一个url数组。

$keywords = keyword_split($res['keywords']);$path='../ajax/search.php?key=';foreach($keywords as $k){	$filename = $path.$k;	$content = 这里怎么调用这个php文件并返回内容???;	var_dump($content);}


回复讨论(解决方案)

$content = file_get_contents($filename);试试

$content = file_get_contents($filename);试试 这个不行。file_get_content不支持带参url


$content = file_get_contents($filename);试试 这个不行。file_get_content不支持带参url

我想了下 带参数的话得带上http协议  http://.................

直接用本地的php文件并且带参数 我还没想到办法.



$content = file_get_contents($filename);试试 这个不行。file_get_content不支持带参url

我想了下 带参数的话得带上http协议  http://.................

直接用本地的php文件并且带参数 我还没想到办法. 还是在页面里写个js用ajax调用吧,还没想到好办法

你的方法加上http走服务器一下就可以了吧

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn