【问题标题】:how to remove = and ? from URL in php如何删除 = 和?来自 php 中的 URL
【发布时间】:2018-09-26 01:40:20
【问题描述】:

我想删除?和 = 来自我的 URL “http://localhost/G-Zip/offices-view.php?id=11041”,使用 .htaccess。 我使用此代码从 URL 中删除扩展名。

从 URL 中删除 .PHP

RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]

【问题讨论】:

标签: php mysql .htaccess


【解决方案1】:

试试 PHP 中的 str_replace() 函数:

echo str_replace("?",""," http://localhost/G-Zip/offices-view.php?id=11041");

上面的代码会删除 ?从网址

echo str_replace("=",""," http://localhost/G-Zip/offices-view.php?id=11041");

上面的代码会从 URL 中删除 =

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-27
    • 2012-03-10
    • 1970-01-01
    • 2017-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多