我正在使用模型视图控制器,并且在我的URL中,我需要在URL的末尾有斜杠。如何检查它是否有斜线?PHP:检查URL是否包含末尾的斜线
http://localhost/tabulation/event/event_name/<--I need to check this slash
$url = isset($_GET['url']) ? $_GET['url'] : null;
$url = rtrim($url. '/');
$url = explode('/', $url);
//if($url[2] has no backslashes then execute the condition
你的'rtrim'不正确。不要连接结尾字符是第二个参数。然后你可以追加一个'/'因为你知道末尾的斜线被删除了。 – chris85