【发布时间】:2010-12-06 19:29:08
【问题描述】:
我没办法了,这是我的控制器:
class GoogleNewsController extends AppController {
var $name = 'GoogleNews';
var $uses = array('GoogleNews', 'SavedNews');
var $helpers = array('Html','Form');
function index() {
$saved = $this->set('news',$this->GoogleNews->find('all'));
我正在从“GoogleNews”读取数据,它们在我的数组中。数组如下所示:
array(10) {
[0]=>
array(1) {
["GoogleNews"]=>
array(12) {
["title"]=>
string(32) "FIFA 11 für 25,49€ aus Jersey"
["link"]=>
string(54) "http://feedproxy.google.com/~r/myDealZ/~3/HuNxRhQJraQ/"
["pubDate"]=>
string(31) "Mon, 06 Dec 2010 10:53:22 +0000"
["creator"]=>
string(5) "admin"
["guid"]=>
array(2) {
["value"]=>
string(30) "http://www.mydealz.de/?p=15137"
["isPermaLink"]=>
string(5) "false"
}
["description"]=>
string(355) "
我想将元素保存到我的数据库“SavedNews” 我需要保存描述和标题。 谁能告诉我应该怎么写?
$this->SavedNews->set(array('description' =>$this->GoogleNews->find('description')));
这是一个解决方案吗? 这是它唯一的工作方式,但它会将空值放入我的列中。
【问题讨论】:
标签: arrays cakephp model controller