Discuz Ucenter integrates your application code
Installation (not to mention details)
After the official installation, the ucenter and dz will be automatically connected, as shown in the figure below
3. Add your own new application
Click Add new application, select custom, and enter
4. Create your own test environment
Copy UCenter_1.5.0_ SC _UTF8 (1) advancedexamples to your test directory, and put the uc_client in advanced to the examples directory ~~
(1) modify config. inc. php to configure your local machine. The following is my configuration. For details, refer
<? Php
Define ('UC _ CONNECT ', 'mysql ');// Method for connecting to the UCenter: mysql/NULL. The default value is fscoketopen ()
// Mysql is a directly connected Database. For efficiency, mysql is recommended.
// Database-related (the following variables must be configured when UC_DBLINK is not set during mysql connection)
Define ('UC _ dbhost', 'localhost ');// UCenter database host
Define ('UC _ dbuser', 'root ');// UCenter database username
Define ('UC _ DBPW ','');// UCenter database password
Define ('UC _ dbname', 'ps _ ucenter ');// UCenter database name
Define ('UC _ dbcharset', 'utf8 ');// UCenter database character set
Define ('UC _ dbtablepre', 'ps _ ucenter. UC _');// UCenter database table prefix
// Communication problems
Define ('UC _ key', 'example2 ');// The communication key of the UCenter must be consistent with that of the UCenter.
Define ('UC _ api', 'http: // localhost/project/passport/ucenter_1.5.0_ SC _utf8 (1)/upload ');// UCenter URL, which depends on this constant when calling the Avatar
Define ('UC _ charset', 'utf8 ');// UCenter character set
Define ('UC _ IP ','');// UCenter IP address. Set this value when UC_CONNECT is not in mysql mode and the domain name is resolved by the current application server.
Define ('UC _ APPID ', 4 );// ID of the current application
// Application database connection parameters used by ucexample_2.php
$ Dbhost = 'localhost ';// Database server
$ Dbuser = 'root ';// Database username
$ Dbpw = '';// Database password
$ Dbname = 'ps _ example ';// Database name
$ Pconnect = 0;// Database persistent connection 0 = disabled, 1 = enabled
$ Tablepre = 'example _';// Table name prefix. Modify the table name prefix here to install multiple forums in the same database.
$ Dbcharset = 'utf8 ';// MySQL character set. Optional values: 'gbk', 'big5', 'utf8', and 'latin1'. The reserved values are set according to the Forum character set.
// Synchronous login Cookie settings
$ Cookiedomain = '';// Cookie scope
$ Cookiepath = '/'; // cookie action path
Copy code
This is mine. Note that the database configuration and UC_KEY must be the same as the custom one...
Then go to the Ucenter application management page. If the following is displayed, the configuration is correct, and then proceed to the following steps:
(2) create a test database ps_example and create the following table:
Create table 'example _ members '(
'Uid' int (11) not null comment 'uid ',
'Username' char (15) default null comment 'username ',
'Admin' tinyint (1) default NULL comment' is administrator ',
Primary key ('uid ')
) TYPE = MyISAM;
Copy code
(3) go to the example directory and open ucexample_1.php and ucexample_2.php for testing ~~~!
If it succeeds, you can see the following figure (the screenshot of running ucexample_2.php)