Thinkphp3.1 how can I not connect to the mysql database?

Source: Internet
Author: User
Why can't thinkphp3.1 connect to the mysql database? please help me! thinkphp3.1 cannot connect to the mysql database. please help me !!! Project configuration file config. php: & lt ;? Phpreturnarray (& nbsp; APP_STATUS & gt; debug, & nbsp; DB_TYPE thinkphp3.1 cannot connect to the mysql database. please help me.
Thinkphp 3.1 cannot connect to the mysql database. please help me !!!

Project configuration file config. php:

Return array (
'App _ status' => 'debug ',
'Db _ type' => 'mysql', // Database TYPE
'Db _ host' => 'localhost', // server address
'Db _ name' => 'thinkphp', // database NAME
'Db _ user' => 'root', // USER name
'Db _ pwd' => '123', // password
'Db _ port' => '123', // PORT
'Db _ prefix' => 'think _ ', // database table PREFIX
'Db _ FIELDTYPE_CHECK '=> false, // whether to check the field type
'Db _ FIELDS_CACHE '=> true, // enable field caching
'Db _ charset' => 'gb2312', // The database encoding uses utf8 by default.
'Db _ DEPLOY_TYPE '=> 0, // Database deployment method: 0 centralized (single server), 1 distributed (master/slave server)

'Db _ RW_SEPARATE '=> false, // whether the master-slave mode is valid for database read/write splitting
'Db _ MASTER_NUM '=> 1, // number of master servers after read/write splitting
'Db _ slave_no' => '', // specify the serial number of the slave server
'Db _ SQL _BUILD_CACHE '=> false, // create a cache for the SQL statement queried by the database
'Db _ SQL _BUILD_QUEUE '=> 'File', // The cache method of the SQL cache queue supports file xcache and apc.
'Db _ SQL _BUILD_LENGTH '=> 20, // The length of the SQL cache queue
'Db _ SQL _LOG '=> false, // SQL execution log records

);
?>

MYSQL contains a table in the thinkphp database and think_abc with the id int primary key auto_increment, name varchar (20), age int, and sex bool fields.

Controller file IndexAction. class. php:

Class IndexAction extends Action {
Public function index (){
$ Data = array (
'Name' => 'dong ',
'Age' => 21,
'Sex '=> 1
);
M ('ABC')-> add ($ data );
}
}
?>

Enter http: // localhost/app/index in the browser. "page error" is displayed in the browser after php. try 'http: // localhost/app/index later. php/index/has also tried to define other functions that do not connect to mysql here to run normally. I can't help beginners.

------ Solution --------------------
Delete the Runtime directory under the app and try again!

If not, send a message.

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.