加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

php使用正则表达式处理路径

发布时间:2020-05-25 02:11:29 所属栏目:PHP 来源:互联网
导读:本文章向大家介绍php如何使用正则表达式处理路径,主要使用到php的ereg_replace函数,需要的朋友可以参考一下本文章。

php使用正则表达式处理路径,源代码如下:

if (isset($_POST['posted'])) {

$path = $_POST['path'];

$outpath = ereg_replace(".[.]+","",$path);

$outpath = ereg_replace("^[/]+",$outpath);

$outpath = ereg_replace("^[A-Za-z][:|][/]?",$outpath);

/* http://www.manongjc.com/article/1319.html */

echo "The old path is " . $path . " and the new path is " . $outpath;

}

?>

Enter your file path for cleaning:

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读