相关疑难解决方法(0)

只应通过引用传递变量

// 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

220
推荐指数
9
解决办法
23万
查看次数

如何从右到左爆炸弦?

$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)

php string

18
推荐指数
4
解决办法
2万
查看次数

仅在最后一次出现爆炸匹配时爆炸字符串

我正在尝试爆炸一个字符串,但我需要它仅在最后爆炸'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)

php explode

3
推荐指数
1
解决办法
2014
查看次数

标签 统计

php ×3

explode ×1

string ×1