怎么检查页面URL中是否有某个字符串
程序员文章站
2022-06-07 21:57:59
...
如何检查页面URL中是否有某个字符串?
鉴于安全,想获取本页面的url,检查里面是否有“script”这个字符串,若有则禁止访问或退出。该如何实现?
------解决方案--------------------
strstr strpos
------解决方案--------------------
you should have a html parser...
------解决方案--------------------
you should have a html parser. I suppose there are such php version in the wild.
------解决方案--------------------
鉴于安全,想获取本页面的url,检查里面是否有“script”这个字符串,若有则禁止访问或退出。该如何实现?
------解决方案--------------------
strstr strpos
------解决方案--------------------
you should have a html parser...
------解决方案--------------------
you should have a html parser. I suppose there are such php version in the wild.
------解决方案--------------------
- PHP code
function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") { $pageURL .= "s"; } $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; } return $pageURL; }相关文章
相关视频
上一篇: php仿冒ip