我正在尝试加载Table
JoomShopping
类别ID为3,但是当我执行EMPTY
var_dump()
提供了什么
从DB我可以看到有一个ID为3的类别
$category_id = JRequest::getInt('category_id');
$category = &JTable::getInstance('category', 'jshop');
$category = $category->load(array('category_id'=>3));
var_dump($category);exit;
请告诉我哪里出错了
答案 0 :(得分:1)
您只需使用类别对象,就不需要将加载结果保存到任何变量。
尝试使用此代码 -
$category_id = JRequest::getInt('category_id');
$category = &JTable::getInstance('category', 'jshop');
$category->load(5);
print_r($category);exit;
//对于Joomla 3
$jinput = JFactory::getApplication()->input;
$category_id = $jinput->get('category_id', '', 'INT');
$category = JTable::getInstance('category', 'jshop');
$category->load($category_id);
print_r($category);exit;