$baseUrl = request()->baseUrl();
if (!preg_match('/admin.php/',$baseUrl)) {
$this->redirect('/admin.php'.$baseUrl);
}
很实用的php自带方法。
<?php
//模式分隔符后的"i"标记这是一个大小写不敏感的搜索
if (preg_match("/php/i", "PHP is the web scripting language of choice.")) {
echo "A match was found.";
} else {
echo "A match was not found.";
}
?>