// 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天后仍然卡住了.
我想在最后一个/在一个网址之后得到这些字符 http://www.vimeo.com/1234567
我怎么用PHP?
我想获取URL中的最后一个路径段:
http://blabla/bla/wce/news.php
要么http://blabla/blablabla/dut2a/news.php
例如,在这两个URL中,我想获得路径段:'wce'和'dut2a'.
我尝试使用$_SERVER['REQUEST_URI']
,但我得到了整个URL路径.
我需要在最后一个"/"之前删除每个字符
这是我的网址:
http://www.example.com/highlights/cat/all-about-clothing/
我想只有:
all-about-clothing
Run Code Online (Sandbox Code Playgroud)
谢谢
我string
喜欢这个http://domain.sf/app_local.php/foo/bar/33
.最后的字符是id
元素.他的长度不止一个,所以我不能用:
substr($dynamicstring, -1);
Run Code Online (Sandbox Code Playgroud)
在这种情况下必须
substr($dynamicstring, -2);
Run Code Online (Sandbox Code Playgroud)
如何在"/ bar /"之后获取caracters string
而不取决于长度?
从变量中的URL获取id有问题!
网址就是这样的 domain.com/article/1123/
它和许多id一样充满活力
我想在变量中保存1123请帮忙!
用这个来试试吧
if(isset($_GET['id']) && !preg_match('/[0-9]{4}[a-zA-Z]{0,2}/', $_GET['id'], $id)) {
require_once('404.php');
} else {
$id = $_GET['id'];
}
Run Code Online (Sandbox Code Playgroud) 有一个网址类型
https://example.com.ua/part1/part2/part3/product-123.html
Run Code Online (Sandbox Code Playgroud)
如何获得product-123.html
正则表达式?
我试过这个:
echo
preg_replace('#/([a-zA-Z0-9_-]+\.html)$#','$1','https://example.com.ua/part1/part2/part3/product-123.html');
Run Code Online (Sandbox Code Playgroud)