// 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天后仍然卡住了.
$split_point = ' - ';
$string = 'this is my - string - and more';
Run Code Online (Sandbox Code Playgroud)
如何使用$ split_point的第二个实例而不是第一个实例进行拆分.我能以某种方式指定从右到左的搜索吗?最简单的方法?
基本上我如何从右到左爆炸.我想拿起" - "的最后一个例子.
结果我需要:
$item[0]='this is my - string'; $item[1]='and more';
Run Code Online (Sandbox Code Playgroud)
并不是:
$item[0]='this is my'; $item[1]='string - and more';
Run Code Online (Sandbox Code Playgroud) 我正在尝试爆炸一个字符串,但我需要它仅在最后爆炸'and'
而不是每个爆炸'and'
。有没有办法做到这一点?
<?php
$string = "one and two and three and four and five";
$string = explode(" and ", $string);
print_r($string);
?>
Run Code Online (Sandbox Code Playgroud)
结果:
数组([0] =>一个[1] =>两个[2] =>三个[3] =>四个[4] =>五个)
需要结果:
数组([0] => 1和2以及3和4 [1] => 5)