你會在你的專案底下的protected資料夾發現有個yiic.bat, 但是如果你在windows的命令提示字元輸入
>cd c:\xampp\htdocs\你的專案名稱\protected
接著輸入
>yiic shell
就會出現這句錯誤
>Error: index.php does not exist or is not an entry script file.
解決方法是要輸入
>yiic shell ../index.php
本人原本是用編輯器以OOP來寫PHP, 但因為有大大說別再刻輪子了, 所以下定決心要好好學個MVC架構的框架, 讓自己的程式結構分明、易維護. 最後經過多方比較後決定學Yii framework, 學習的過程中, 深刻感受到國內關於這個框架的資源, 相較國外及大陸之下明顯不足, 所以希望自己能為台灣的開發者盡一份力. 我是Joker 一位自學者, 一起來大玩特玩吧!
2013年10月17日 星期四
2013年10月15日 星期二
yii framework - 建立一個部落格要建立CRUD時候出錯了?
我想學 官網的部落格範例 一樣嘗試用yii建立一個blog, 但是在建立完model後, 要用
Crud Generator卻出現下面的error:
CDbCommand failed to execute the SQL statement: CDbCommand failed to prepare the SQL statement: SQLSTATE[HY000]: General error: 1 near ".": syntax error. The SQL statement executed was: PRAGMA table_info('tbl_comment'.'tbl_post')
我config資料夾裡的main.php的db設定是這樣
'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/blog.db',
'tablePrefix'=>'tbl_', //<- 加上這句告訴db我們資料表的前綴字是什麼
),
跟大陸的教學一樣但是還是不行, 為什麼會這樣呢?
Crud Generator卻出現下面的error:
CDbCommand failed to execute the SQL statement: CDbCommand failed to prepare the SQL statement: SQLSTATE[HY000]: General error: 1 near ".": syntax error. The SQL statement executed was: PRAGMA table_info('tbl_comment'.'tbl_post')
我config資料夾裡的main.php的db設定是這樣
'db'=>array(
'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/blog.db',
'tablePrefix'=>'tbl_', //<- 加上這句告訴db我們資料表的前綴字是什麼
),
跟大陸的教學一樣但是還是不行, 為什麼會這樣呢?
2013年10月10日 星期四
yii framework - No input file specified 解決方法(正解)
1. 將server根目錄的php5.ini (沒有就建立一個)裡加上這句
cgi.fix_pathinfo = 1
2. 修改protected資料夾下的.htaccess, 把內容改成下面這樣 (不要傻傻複製上下的米號ㄟ)
*******************************************
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . /index.php
*******************************************
cgi.fix_pathinfo = 1
2. 修改protected資料夾下的.htaccess, 把內容改成下面這樣 (不要傻傻複製上下的米號ㄟ)
*******************************************
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . /index.php
*******************************************
怎麼學習PHP yii framework ?
我也是網路各種爬文、找資料 (我的習慣是先理解再實作)
找到幾個很棒的網站分享給大家:
找到幾個很棒的網站分享給大家:
http://www.yiiframework.com/doc/api/1.1/ (官網, 查Class-類、Properties-屬性、Methods-方法很好用)
http://www.yiichina.com/api/ (不要打我~ 就是有簡體版的沒錯! 但是上面是1.0版, 目前官方已經出到1.1版了!所以我有時候會中英對照看)
http://www.yiichina.com/topic/4786/ (裡面說這主要是透過開發Windows應用C++、C#工程師的角度幫助Windows 桌面應用或ASP.Net工程師較快的掌握PHP Yii Framework應用程序框架。)
http://www.yiichina.com/api/ (不要打我~ 就是有簡體版的沒錯! 但是上面是1.0版, 目前官方已經出到1.1版了!所以我有時候會中英對照看)
http://www.yiichina.com/topic/4786/ (裡面說這主要是透過開發Windows應用C++、C#工程師的角度幫助Windows 桌面應用或ASP.Net工程師較快的掌握PHP Yii Framework應用程序框架。)
訂閱:
文章 (Atom)