PHP 5.3.5 および 2.0.2 CI を使用して WAMP に CodeIgniter をセットアップしようとしています。「Hello World」アプリケーションは正常に実行されました (コントローラーとビューしかありませんでした)。次に、モデル test.php を追加しました
class Tests extends CI_Model {
function __construct() {
parent::__contruct();
}
}
コントローラーでモデルを次のようにインスタンス化します。
$this->load->model('Tests');
しかし、私はこのエラーを受け取り続けます:
システムのタイムゾーン設定に頼るのは安全ではありません。
このエラーを解決するにはどうすればよいですか? php.ini で date.timezone プロパティを設定してみました。date_default_timezone_set
CIのindex.phpでもメソッドを呼び出してみました。私は CI フォーラムを調べましたが、誰もが電話して問題を解決したようdate_default_timezone_set
です。しかし、メソッドを呼び出しても、エラーは発生しません。代わりに、Apache から 500 サーバー エラー応答が返されます。
PHP と CI の専門家..あなたの助けが必要です。
最新のアップデート
マットの下で物事がどのように実行されるかを確認するために、ログを有効にしました。これが私のモデルです:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Hello extends CI_Model {
function __construct()
{
log_message('debug', "Staring Hello Model");
parent::__construct();
log_message('debug', "Done with Hello Model");
}
}
私のコントローラー:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Hello extends CI_Controller {
public function index()
{
//$this->load->view('hello');
echo phpinfo();
}
public function newfun()
{
log_message('debug', "Starting new method...");
$this->load->model('hello');
log_message('debug', "Completed model load...");
$this->load->view('hello');
}
}
そして私のログファイル:
DEBUG - 2011-04-18 15:01:44 --> Config Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Hooks Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Utf8 Class Initialized
DEBUG - 2011-04-18 15:01:44 --> UTF-8 Support Enabled
DEBUG - 2011-04-18 15:01:44 --> URI Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Router Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Output Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Security Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Input Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Global POST and COOKIE data sanitized
DEBUG - 2011-04-18 15:01:44 --> Language Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Loader Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Controller Class Initialized
DEBUG - 2011-04-18 15:01:44 --> Starting new method...
DEBUG - 2011-04-18 15:01:44 --> Model Class Initialized
最後のログ出力は、ci/system/core フォルダーにある Model.php のコンストラクターからのものです。モデルのコントローラーが実行されている兆候はありません (モデルからのログ メッセージは表示されません)。
モデルの何が問題になっていますか? 私はそれを正しくコーディングしていますか、それともばかげたことを見落としていますか?