以下のように示されているコントローラーとビューがあり、しばらくの間は完全に機能しますが、サーバーに対していくつかの要求が行われた後 (つまり、1 秒ごとにリロードし続ける)、この行で失敗します
if (!$this->tank_auth->is_logged_in())
理由もなく、天気が混雑しているのかどうかはわかりません...
firebug でクライアント コードをデバッグしようとして、この行にブレーク ポイントを置いたままにすると、
$('#buy_reload').load('buy/reload'); //And press f8 every time
問題は何ですか?ロード?
Zコントローラー
class Buy extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->library('tank_auth');
$this->load->model(array('tank_auth/users','players','cash','inventory','items','shopping_cart','purchases','processing'));
}
function reload()
{
if (!$this->tank_auth->is_logged_in()) {
redirect('/auth/login/');
} else {
//do those stuffs
}
}
}
Z ビュー内のスクリプト
<script>
setInterval(function() {
$('#buy_reload').load('buy/reload');
}, 1 * 1000);
</script>