Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 解析URL时遇到问题 $editThisUrl=“”; echo$editThisUrl;_Php_Regex - Fatal编程技术网

Php 解析URL时遇到问题 $editThisUrl=“”; echo$editThisUrl;

Php 解析URL时遇到问题 $editThisUrl=“”; echo$editThisUrl;,php,regex,Php,Regex,因此,我试图从上面的$editThisUrl解析“index.php/admin/”——我无法正确获取正则表达式。我在CMS中使用非常严格的路径,有什么想法吗?感谢您的帮助为什么不直接使用 我不明白这个问题。你能举个例子吗。$editThisUrl看起来像这样:http://test.example.net/index.php/admin/downloads/HPIM0276%20Alll%20Day%20Long.JPG我需要它看起来像这样:http://test.example.net/do

因此,我试图从上面的$editThisUrl解析“index.php/admin/”——我无法正确获取正则表达式。我在CMS中使用非常严格的路径,有什么想法吗?感谢您的帮助

为什么不直接使用


我不明白这个问题。你能举个例子吗。$editThisUrl看起来像这样:
http://test.example.net/index.php/admin/downloads/HPIM0276%20Alll%20Day%20Long.JPG
我需要它看起来像这样:
http://test.example.net/downloads/HPIM0276%20Alll%20Day%20Long.JPG
尝试使用str_替换,在上述情况下,
echo$begone_索引
给我的结果与echo$editThisURL相同
$editThisUrl = "<li><a href=\"".$path.$file."\">$file</a></li>";
echo $editThisUrl;
$begone_index = str_replace("index.php/admin/","",$editThisURL);