我想从脚本返回每个回声“完成”或“错误”的返回值。首先,我可以使用php函数file_get_contents
来处理这个问题,但它返回我的整个脚本,不仅仅是我在脚本中打印的东西。然后,我相信在cURL
方法,但它不能得到它的工作....在PHP中使用返回值调用php脚本
这就是所谓的脚本:
<?php
include("config.php");
print "complete";
?>
剧本与我的卷发:
$url="caller.php";
$ch = curl_init(); //initialize curl handle
curl_setopt($ch, CURLOPT_URL, $url); //set the url
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); //return as a variable
$response = curl_exec($ch); //run the whole process and return the response
curl_close($ch); //close the curl handle
echo "test". $response."|";
为什么这不起作用?我怎样才能使它工作?!文件方法?
不应该该网址是一个实际的网址?像'file:/// caller.php' –
只是试过了,它不能和'file://'url一起工作,这会在不执行php代码的情况下回应完整的文件内容。 –