// Other variables
$MAX_FILENAME_LENGTH = 260;
$file_name = $_FILES[$upload_name]['name'];
//echo "testing-".$file_name."<br>";
//$file_name = strtolower($file_name);
$file_extension = end(explode('.', $file_name)); //ERROR ON THIS LINE
$uploadErrors = array(
0=>'There is no error, the file uploaded with success',
1=>'The uploaded file exceeds the upload max filesize allowed.',
2=>'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
3=>'The uploaded file was only partially uploaded',
4=>'No file was uploaded',
6=>'Missing a temporary folder'
);
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?2天后仍然卡住了.
在PHP中,是否有一种可靠而好的方法来获取这些东西:
协议:即http或https Servername:例如localhost Portnumber:例如8080
我可以使用获取服务器名称$_SERVER['SERVER_NAME'].
我可以得到协议,但我不认为它是完美的:
if(strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https') {
return "https";
}
else {
return "http";
}
Run Code Online (Sandbox Code Playgroud)
我不知道如何获得端口号.我使用的端口号不是80 ..它们是8080和8888.
谢谢.
php ×2