public function addit() {
$this->autoRender = false;
if ($this->request->is('post')) {
// $this->Products->addProduct($this->request->data['Cart']['product_id']);
echo "".$this->Products->get($id);//for test
} else {
echo "".$this->Products->get($id);//for test
}
}
我想获取变量a的值是此函数之外的单独变量。 a的值来自另一个Controller类。
答案 0 :(得分:0)
在方法外部声明一个变量,然后在方法内部更改该变量。
private static final String CREATE_SERIES_TABLE =
"CREATE TABLE " + SERIES_TABLE + " (" +
KEY_SERIE_ID + " LONG PRIMARY KEY, "
+ KEY_SERIE_PORTADA + " BLOB NOT NULL, "
+ KEY_SERIE_TITULO + " TEXT NOT NULL, "
// Here ------------^
+ KEY_SERIE_AÑO + " INTEGER NOT NULL, "
// Here ---------^
+ KEY_SERIE_GENERO + " TEXT NOT NULL, "
// Here ------------^
+ KEY_SERIE_DESCRIPCION + " TEXT NOT NULL, "
// Here -----------------^
+ KEY_SERIE_TEMPORADAS + " INTEGER NOT NULL"
// Here ----------------^
+ ")";