I will execute this command in Command Prompt
php C:\xampp\htdocs\dl.php
These are the properties of my htdocs directory:
However, under the sharing tab, I have write permissions under all users:
I've restarted apache after each permission modification with no success. How do I fix this?
My PHP script downloads an XML file via an API and writes the XML file into the root directory of the server. When I execute www.mydomain.com/dl.php, the downloaded XML is written into the root directory; however, when I execute the PHP file (dl.php) via the command prompt, it will not write the downloaded file into the root directory.
PHP file:
$today = date("F j, Y").".xml";
$ch = curl_init ("");
$fp = fopen("ipod_car_connectors2.xml", "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
尝试将其更改为:
$fp = fopen("c:\\xampp\\htdocs\\ipod_car_connectors2.xml", "w");
The solution was to escape slashes
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.