ThinkphpU method generation problem. Submitted in my form is written as follows: & lt; form & nbsp; action {: U (GROUP_NAME.Loginlogin)} & nbsp; methodpost & nbsp; & gt; after submission, the page should jump to: emerge 1.87.98.198index.phploginlogin. now the thinkphp U method is generated.
The submission in my form is written as follows:
After submission, you should jump to: http: // route 1.87.98.198/index. php/Login/login
After the request is submitted, it should be redirected to: http: // localhost/index. php/Login/login.
In my server configuration file, 'DB _ host' => 'localhost'. do you need to set the U method separately?
The Nginx server is used.
Now the question is how to configure U to change localhost to ip address?
------ Solution --------------------
Have you changed the U function? Here
if($domain) {
$url = 'http://'.$domain.$url;
}else{
$url = "http://".$_SERVER['SERVER_NAME'].($_SERVER['SERVER_PORT']==80?'':':'.$_SERVER['SERVER_PORT']).$url;
}
The generated url is always an absolute address, and I remember it is always a relative path. delete else.
------ Solution --------------------
This post was last edited by xuzuning at 11:25:00
He finally
If ($ domain ){
$ Url = 'http: // '. $ domain. $ url;
} Else {
$ Url = "http: //". $ _ SERVER ['server _ name']. ($ _ SERVER ['server _ port'] = 80? '': '. $ _ SERVER ['server _ port']). $ url;
}
When you call U (GROUP_NAME. '/Login/login'), there is no $ domain
So take the else branch, that is, what domain name you use to access is what domain name
If you want to define your own
U (GROUP_NAME. '/Login/login', '', true, false, $ IP)