ThinkphpU method generation problems

Source: Internet
Author: User
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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.