我将 DooPHP 用于我的 Json 服务,除了 1 个问题外一切正常: DooPHP 的 Mysql Orm 产生了不干净的结果(我尝试了所有配置)。
我有一个模型:
public $id;
public $name;
public $content;
public $image_small;
public $image_large;
public $category_id;
public $orderday;
public $creat_time;
public $_table = 'recipe';
public $_primarykey = 'id';
public $_fields = array('id','name','content','image_small','image_large','category_id','orderday','creat_time');
我这样写查询:
$food = Doo::db()->find('Recipe',array('select' => 'id, name, image_small, image_large,category_id'));
但是数组中的结果:(SELECT id, name, image_small, image_large,category_id FROM recipe)
Array
(
[0] => Recipe Object
(
[id] => 1
[name] => Chicken
[content] =>
[image_small] => image_small/0872c3146bc78b74a006b41353aab13c.jpg
[image_large] => image_large/0872c3146bc78b74a006b41353aab13c.jpg
[category_id] => 1
[orderday] =>
[creat_time] =>
[_table] => recipe
[_primarykey] => id
[_fields] => Array
(
[0] => id
[1] => name
[2] => content
[3] => image_small
[4] => image_large
[5] => category_id
[6] => orderday
[7] => creat_time
)
)
[1] => Recipe Object
(
[id] => 3
[name] => Bak Kut Teh 2
[content] =>
[image_small] =>
[image_large] =>
[category_id] => 4
[orderday] =>
[creat_time] =>
[_table] => recipe
[_primarykey] => id
[_fields] => Array
(
[0] => id
[1] => name
[2] => content
[3] => image_small
[4] => image_large
[5] => category_id
[6] => orderday
[7] => creat_time
)
)
)
我想删除所有与速度无关的数据(_fields,_table..),并且不选择:content,creat_time ...