我写了一个php页面能下载远程js,单独运行页面很好,但是作为计划任务运行的时候提示任务完成,但是js并没有被下载下来,有谁知道是什么原因么?下面是页面代码:- <?php
- $ch = curl_init('http://php.weather.sina.com.cn/js.php?city=荆州&day=0') ;
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true) ;
- curl_setopt($ch, CURLOPT_BINARYTRANSFER, true) ;
- $output = curl_exec($ch) ;
- $destination_folder = 'js/';
- $newfname = $destination_folder . 'weather.js';
- $newf = fopen($newfname, 'w');
- if ($newf){
- fwrite($newf, $output) ;
- }
- if ($newf) {
- fclose($newf);
- }
- ?>
复制代码 |