thinkphp3.2.3配置

來源:互聯網
上載者:User

1、下載Thinkphp3.2.3架構

2、解壓放到WWW檔案夾

3、在Application->Home->Controller下資料控制器IndexController.class.php 代碼

<?phpnamespace Home\Controller;use Think\Controller;class IndexController extends Controller {    public function index(){        $Data =M('notice');        $result =$Data->find(1);        $this->assign('result',$result);        $this->show();    }}

4、Application->Home->View下建立檔案夾index,建立index.html代碼

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>Title</title></head><body>{$result.id}</body></html>
5、Application->Home->Conf->Config.php配置模組檔案訪問資料庫

<?phpreturn array(   //'配置項'=>'配置值'    'DB_TYPE'               =>  'mysql',     // 資料庫類型    'DB_HOST'               =>  'localhost', // 伺服器位址    'DB_NAME'               =>  'tuiguang',          // 資料庫名    'DB_USER'               =>  'root',      // 使用者名稱    'DB_PWD'                =>  '',          // 密碼    'DB_PORT'               =>  '3306',        // 連接埠    'DB_PREFIX'             =>  'tuiguang_',    // 資料庫表首碼    'DB_PARAMS'            =>  array(), // 資料庫連接參數    'DB_DEBUG'           =>  TRUE, // 資料庫偵錯模式 開啟後可以記錄SQL日誌    'DB_FIELDS_CACHE'       =>  true,        // 啟用欄位緩衝    'DB_CHARSET'            =>  'utf8',      // 資料庫編碼預設採用utf8    'DB_DEPLOY_TYPE'        =>  0, // 資料庫部署方式:0 集中式(單一伺服器),1 分布式(主從伺服器)    'DB_RW_SEPARATE'        =>  false,       // 資料庫讀寫是否分離 主從式有效    'DB_MASTER_NUM'         =>  1, // 讀寫分離後 主伺服器數量    'DB_SLAVE_NO'           =>  '', // 指定從伺服器序號);

6、phpMyAdmin建立個資料庫tuiguang,並且建立個表命名為tuiguang_notice,新增欄位id,插入值1

7、瀏覽器輸入localhost可以顯示1


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.