我正在使用模型视图控制器,我的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