当我使用linux并尝试使用此脚本将文件上传到远程服务器时,一切正常。但是,如果我使用Windows,那么脚本不工作。 脚本:cURL将文件上传到MS Windows上的远程服务器
$url="http://site.com/upload.php";
$post=array('image'=>'@'.getcwd().'images/image.jpg');
$this->ch=curl_init();
curl_setopt($this->ch, CURLOPT_URL, $url);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_TIMEOUT, 30);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($this->ch, CURLOPT_POST, 1);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $post);
$body = curl_exec($this->ch);
echo $body; // << on Windows empty result
我在做什么错?
PHP 5.3
的Windows 7 - 不工作,Ubuntu Linux操作系统的10.10 - 如果你使用的是Windows工作
你有没有在你的PHP安装编译卷曲在你的Windows服务器上?显示给出的错误信息。您可以通过[phpinfo()](http://php.net/manual/en/function.phpinfo.php)脚本检查安装。 – Orbling 2011-01-31 00:40:58
错误未显示。 (error_reporting = on) – Dador 2011-01-31 00:46:41
getcwd()不会以斜线结尾返回,所以我错过了那个,除此之外不应该在Windows上使用反斜杠而不使用反斜杠? – 2011-01-31 00:48:02