例子我有3篇文章每篇文章都有按钮“阅读更多”。我得到1篇文章有这样的数组。
Dump => object(stdClass)#21 (6) {
["id"] => string(2) "76"
["id_admin"] => string(0) ""
["judul_berita"] => string(5) "kasus"
["content"] => string(449) "
This is my first use of nestedsortable.js in a custom cms creation with codeigniter, So I use it with Codeigniter php framework. I have an ordered and nested list(for order pages) and I need to convert this list to array with 'toArray' but it's not working the error message: uncaught typeError: Cannot call method 'match' of undefined this is my js code:
"
["tanggal"] => string(10) "2014-03-25"
["slug"] => string(5) "kasus"
}
和另外两篇文章
Dump => array(0) {
}
错误代码在哪里?
我的控制器
public function index($id = null, $slug = FALSE){
// Fetch the article
$this->db->where('pubdate <=', date('Y-m-d'));
$this->data['article'] = $this->mberita->get_by_id($id,$slug);
dump($this->data['article']);
}
我的模特
function get_by_id($id, $slug)
{
return $this->db->get_where($this->tbl_berita, array('id' => $id, 'slug' => $slug),1)->row();
}
请帮我做什么。谢谢。
请检查此代码是否有任何错误?
// Redirect if slug was incorrect
$requested_slug = $this->uri->segment(3);
$set_slug = $this->data['article']->slug;
if ($requested_slug != $set_slug) {
redirect('article/' . $this->data['article']->id . '/' . url_title($this->data['article']->slug), 'location', '301');
}