01-CMS作成に関する注意事項
11055 ワード
1、ThinkPHPコアファイルをプロジェクトディレクトリに、ダウンロードした拡張パッケージをThinkPHPディレクトリの下のExtendフォルダに置く
2、プロジェクト全体の符号化をutf-8に設定
3、Publicパブリックディレクトリを作成するパブリックJS、CSS、Imagesを保存し、indexを作成する.php
admin.php
4、共通の構成のconfig.inc.php
フロントconfigを構成する.phpの場合、導入
デバッグがデータベースに接続されましたか
5、共通のコントローラを継承共通の文字セットをutf-8に設定
Indexモジュール継承共通
2、プロジェクト全体の符号化をutf-8に設定
3、Publicパブリックディレクトリを作成するパブリックJS、CSS、Imagesを保存し、indexを作成する.php
1 <?php
2 header("Content-type: text/html; charset=utf-8");
3 //APP_NAME APP_PATH , 。
4 define('APP_NAME','Home');
5 define('APP_PATH','./Home/');
6 // ,
7 define('APP_DEBUG',true);
8 //APP_NAME APP_PATH , 。
9 require './ThinkPHP/ThinkPHP.php';
10
11
12 ?>
admin.php
1 <?php
2
3 header("Content-type: text/html; charset=utf-8");
4 //APP_NAME APP_PATH , 。
5 define('APP_NAME','Home');
6 define('APP_PATH','./Home/');
7 // ,
8 define('APP_DEBUG',true);
9 //APP_NAME APP_PATH , 。
10 require './ThinkPHP/ThinkPHP.php';
11
12
13 ?>
4、共通の構成のconfig.inc.php
1 <?php
2 return array(
3 //-----------
4 'DB_TYPE'=>'mysql', //
5 'DB_HOST'=>'localhost', //
6 'DB_NAME'=>'thinkphp', //
7 'DB_USER'=>'root', //
8 'DB_PWD'=>'', //
9 'DB_PORT'=>'3306', //
10 'DB_PREFIX'=>'tp_', //
11 // 'DB_DSN'=>'mysql://root:@localhost:3306/thinkphp', // DSN ,
12 //-----------------end
13
14 //--- Trace
15 'SHOW_PAGE_TRACE'=>TRUE,
16 //' '=>' '
17 'URL_PATHINFO_DEPR'=>'/', // PATHINFO , /
18 // URL
19 'URL_CASE_INSENSITIVE' =>true,
20 // , {
21 'TMPL_L_DELIM'=>'<{',
22 // , }
23 'TMPL_R_DELIM'=>'}>',
24 );
25
26 ?>
フロントconfigを構成する.phpの場合、導入
1 <?php
2 $config=include './config.inc.php';
3 $confighome= array(
4 //' '=>' '
5 'USER_AUTH_ON' => true,
6 );
7 return array_merge($config,$confighome);
8 ?>
デバッグがデータベースに接続されましたか
<?php
class IndexAction extends Action {
public function index(){
$m=M('User');
var_dump($m->select()); // bool(false)
//$this->display();
}
}
5、共通のコントローラを継承共通の文字セットをutf-8に設定
1 <?php
2 class CommonAction extends Action{
3 // Action _initialize , ,_initialize
4 function _initialize(){
5 header("Content-Type:text/html; charset=utf-8");
6 }
7 }
8
9 ?>
Indexモジュール継承共通
1 <?php
2 // ,
3 class IndexAction extends CommonAction {
4 public function index(){
5 $m=M('Use');
6 var_dump($m->select());
7 //$this->display();
8 }
9 }