thinkphp3.1如何都连不上mysql数据库 请帮忙

WBOY
Release: 2016-06-13 12:50:56
Original
820 people have browsed it

thinkphp3.1怎么都连不上mysql数据库 请大虾帮忙啊
thinkphp 3.1 怎么都连不上mysql数据库 请大虾帮忙啊!!!

项目配置文件config.php:

return array(
    'APP_STATUS'            => 'debug',
    'DB_TYPE'               => 'mysql',     // 数据库类型
    'DB_HOST'               => 'localhost', // 服务器地址
    'DB_NAME'               => 'thinkphp',          // 数据库名
    'DB_USER'               => 'root',      // 用户名
    'DB_PWD'                => '123456',          // 密码
    'DB_PORT'               => '3306',        // 端口
    'DB_PREFIX'             =>'think_',    // 数据库表前缀
    'DB_FIELDTYPE_CHECK'    => false,       // 是否进行字段类型检查
    'DB_FIELDS_CACHE'       => true,        // 启用字段缓存
    'DB_CHARSET'            => 'gb2312',      // 数据库编码默认采用utf8
    'DB_DEPLOY_TYPE'        => 0, // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)

    'DB_RW_SEPARATE'        => false,       // 数据库读写是否分离 主从式有效
    'DB_MASTER_NUM'         => 1, // 读写分离后 主服务器数量
    'DB_SLAVE_NO'           => '', // 指定从服务器序号
    'DB_SQL_BUILD_CACHE'    => false, // 数据库查询的SQL创建缓存
    'DB_SQL_BUILD_QUEUE'    => 'file',   // SQL缓存队列的缓存方式 支持 file xcache和apc
    'DB_SQL_BUILD_LENGTH'   => 20, // SQL缓存的队列长度
    'DB_SQL_LOG'            => false, // SQL执行日志记录

);
?>

MYSQL里面有个thinkphp数据库、think_abc的表  表有id int primary key auto_increment,name varchar(20),age int,sex bool字段

控制器文件 IndexAction.class.php:

class IndexAction extends Action {
    public function index(){
        $data=array(
            'name'=>'dong',
            'age'=>21,
            'sex'=>1

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!