方法是 remote_file()
if(! function_exists('remote_file')) { function remote_file($url = '', $filename = '') { //set_time_limit(0); if(! $url) { return false; } if(!file_exists('../static/porn/') && !mkdir('../static/porn/', 0777, true)) { return false; } $ext = strrchr($url, "."); if(! $filename) { $filename = time() . $ext; } ob_start(); readdir($url); $content = ob_get_contents(); ob_end_clean(); $size = strlen($content); $fp2 = @fopen('../static/porn/'.$filename, 'a'); fwrite($fp2, $content); fclose($fp2); return config_item('static_site')."porn/{$filename}"; }}
回複內容:
方法是 remote_file()
if(! function_exists('remote_file')) { function remote_file($url = '', $filename = '') { //set_time_limit(0); if(! $url) { return false; } if(!file_exists('../static/porn/') && !mkdir('../static/porn/', 0777, true)) { return false; } $ext = strrchr($url, "."); if(! $filename) { $filename = time() . $ext; } ob_start(); readdir($url); $content = ob_get_contents(); ob_end_clean(); $size = strlen($content); $fp2 = @fopen('../static/porn/'.$filename, 'a'); fwrite($fp2, $content); fclose($fp2); return config_item('static_site')."porn/{$filename}"; }}
有些伺服器環境會禁用掉readdir
的,要麼就是檔案太大逾時了。或者你試試輸出錯誤看看