Home > php教程 > php手册 > 解决四级域名子域名部署问题,希望官网能升级

解决四级域名子域名部署问题,希望官网能升级

WBOY
Release: 2016-06-07 11:38:42
Original
971 people have browsed it

最近项目中遇到了部署四级域名的的子域名部署,TP只能支持到三级域名,所以做了一下小的改动,用来解决四级域名子域名部署问题,理论上支持无限级域名的子域名部署,希望官网能采纳升级
最近项目中遇到了部署四级域名的的子域名部署,TP只能支持到三级域名,所以做了一下小的改动,用来解决四级域名子域名部署问题,理论上支持无限级域名的子域名部署,希望官网能采纳升级
原来的代码为:if(strpos(C('APP_DOMAIN_SUFFIX'),'.')){ // com.cn net.cn <br>                     $domain = array_slice(explode('.', $_SERVER['HTTP_HOST']), 0, -3);<br>                 }else{<br>                     $domain = array_slice(explode('.', $_SERVER['HTTP_HOST']), 0, -2);                    <br>                 }改过之后的代码为:$countDian = substr_count(C('APP_DOMAIN_SUFFIX'),'.');<br>                 if($countDian > 0){ //支持无限级域名子域名部署 <br>                     $domain = array_slice(explode('.', $_SERVER['HTTP_HOST']), 0, -($countDian+2));<br>                 }else{<br>                     $domain = array_slice(explode('.', $_SERVER['HTTP_HOST']), 0, -2);                    <br>                 }

附件 Dispatcher.class.zip ( 4.27 KB 下载:9 次 )

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template