如果 curl returns 在 windows 中出现写入错误,则更改写入权限

change write permission if curl returns write error in windows

每当我 运行 这个代码 shell_exec("curl -o/$filepath https://windows.php.net/downloads/pecl/releases/memcache/3.0.8/logs/php_memcache-3.0.8-$php_version-$thread_type-$vc-$bit-logs.zip | df -k . | tr -dc '[:print:]'");

php,

它总是 return tr: write error

我怎样才能授予

write

的访问权限

script

从命令行?

N.B:如果用户无权写入脚本,我想以编程方式授予对脚本的访问权限

编辑:错误 return 正文也包括这个 curl: (23) Failed writing body (0 != 16094)

你可以像这样在 shell_exec() 函数中嵌入 windows powershell

shell_exec("powershell -command \"& { Start-BitsTransfer -Source https://windows.php.net/downloads/pecl/releases/memcache/3.0.8/logs/php_memcache-3.0.8-$php_version-$thread_type-$vc-$bit-logs.zip -Destination dir/to/save/to/with/name }\"");