ThinkPHP3.0 UCenter integration tutorial

Source: Internet
Author: User

I have been developing ThinkPHP for a while, and I have not written any articles. I am not busy today. I just switched to the red/Black alliance and found few articles on Thinkphp and UCenter integration, even if the version is outdated, Xiao Yu will explain how to integrate the Thinkphp framework with UCenter today.

First, we will install Thinkphp. In this tutorial, we will use Thinkphp3.0 stable version. First, we will download Thinkphp3.0, decompress it, put it in our www directory, and create an index in the root directory. php file and write: require_once '. /ThinkPHP. php'; visit index through the local machine. php and thinkphp generate corresponding directories. (* ^__ ^ *) Xi ...... Very intelligent. Then configure config. php and write it into your database connection configuration. This XiaoYu will not be written. Please do not check the manual!

Download the latest version of UCenter 1.6, create a ucenter directory in the root directory of the website, decompress the UCenter, and upload all the files in the upload directory to the ucenter directory you just created, enter http: // localhost/uceter/install/in the browser. If this is not the access address, replace it with the corresponding access address! Install ucenter.

Find the downloaded UCenter and copy the api folders under uc_client and examples in the advanced directory to the root directory of your website.

Now we start to run uc in our api directory. php is configured. First, open the file in the editor and find the location of 36 rows. We can see that a configuration file require_once DISCUZ_ROOT is imported here. '. /config. inc. php'; Based on the ThinkPHP directory structure, all the configuration files are placed in the Config directory, So we create the config_ucenter.php file in the Config directory and put uc. the PHP file contains about 36 lines of require_once DISCUZ_ROOT. '. /config. inc. php '; change to require_once DISCUZ_ROOT. '. /Conf/config_ucenter.php '; some children's shoes may ask how to configure config_ucenter.php? In fact, this is very simple. We don't even need to write code. simply copy and paste the code and it will be OK. We should first log on to ucenter Application Management and add an application! Click application management on the left-side menu bar, and then we can see that there are no applications, so click Add application. Wow, let's fill in a lot. First, let's choose an application, because we are our own program. Choose another application name. You can just give it a name within 20 bytes. The main url of the application, we will explain Thinkphp integration Ucenter so our Thinkphp is in the directory, here I fill in the http://www.ttedu.com.cn shoes if it is local fill http: // localhost does not need to be added "/". The following is the application IP address. We will leave it blank, so I thought it would be lazy! Application key? Here, fill it in. In fact, you can simply write some strings here. This key is a serious interconnection between the two programs. It is equivalent to getting something from someone else. At least someone else needs to know you, if no one knows you, how can I give it to you? What's more, it is the core member information of the website. Haha! Let's test it. Just fill in "123456". I'm lazy! Physical path of the application? It is also suggested that you do not need to fill in, so leave it blank! Personal data page? How can UCenter be so intelligent? Leave it empty .. Application name. He has already filled it out for me. Let's skip it! Haha

The tag display template does not know what to do .. The tag template tag description is skipped.

Whether to enable synchronous login is not required. Whether to accept the notification and continue the selection. OK. after entering the basic information, submit it. Communication failed? Why? A headache .. We can see that there is a detailed description on the right side of "UCenter configuration information of the application" below: When the UCenter configuration information of the application is lost, you can copy the code on the left to the configuration file of the application. Everything becomes clear. Copy the configuration information in the text box. I remember that the file "config_ucenter.php" we created was still empty. Is it here? Try it! Paste the information and save it. Refresh the ucenter! OK, communication is successful! That's good. We're done with the basic communication!

A little tired. Have a rest! Write it tomorrow! Xiao Yu's website: Beijing Jia Jiao Wang. Let's take a look at the integration effect!

Related Article

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.