thinkphp5 get the current domain name

//Introduced in the head

use think\Request;

//Insert the following code where you need to get the current domain name:

$rs = Request::instance();
$url= $rs->domain();

var_dump($url);die;//url就是当前的域名啦

 

Guess you like

Origin blog.csdn.net/z3287852/article/details/111564181