我与卷曲的工作,使一些上访PHP脚本,我想为你看到下面让上访解析主机,我的剧本是ajax2.php无法在卷曲
$params=['name'=>'John', 'surname'=>'Doe', 'age'=>36,'method'=>'prueba'];
$defaults = array(
CURLOPT_URL => getcwd().'\src\myApp\ajax2.php',
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($params),
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
curl_exec($ch);
if (curl_errno($ch)) {
// this would be your first hint that something went wrong
die('Couldn\'t send request: ' . curl_error($ch));
}
但我得到这个错误:Couldn't send request: Could not resolve host: C
所以,我应该如何调用我的项目文件夹内的脚本?
Linux使用/不是\ – Mihai
你应该使用HTTP或HTTPS URL。如果你在localhost,那么'CURLOPT_URL =>'http:// localhost/YOUT_APP_DIR/src/myApp/ajax2.php',' – jibon57
@ jibon57谢谢你!工作! –