Home  >  Article  >  Backend Development  >  求一段PHP代码,有难度哟.该如何解决

求一段PHP代码,有难度哟.该如何解决

WBOY
WBOYOriginal
2016-06-13 10:49:00690browse

求一段PHP代码,有难度哟...
求一段PHP代码,有难度哟...

我的需求是:访问这个PHP页面后,先判断当前域名是否为*.baidu .com (这个域名可能是a.b.baidu. com ),如果不满足这个条件,则显示"不允许此域名做此操作",如果满足,则用exec函数 重启系统(是用于Windows系统的重启).

谢谢!!

------解决方案--------------------
$mysite = 'baidu.com';
$domain = $_SERVER['SERVER_NAME'];
$domain = explode('.',$domain);

if( $domainp[1].'.'.$domain[2] != $mysite){
system("shutdown -r");
}
------解决方案--------------------
在windows下,你的apache,必须以adminstrators权限运行。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn