方法是 remote_file()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <code> if (! function_exists( 'remote_file' )) {
function remote_file( $url = '' , $filename = '' ) {
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}" ;
}
}</code>
|
Salin selepas log masuk
Salin selepas log masuk
回复内容:
方法是 remote_file()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <code> if (! function_exists( 'remote_file' )) {
function remote_file( $url = '' , $filename = '' ) {
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}" ;
}
}</code>
|
Salin selepas log masuk
Salin selepas log masuk
有些服务器环境会禁用掉readdir
的,要么就是文件太大超时了。或者你试试输出错误看看