我需要在我的模型中存储特殊的chanrate,保存,
我的$model->attributes
就像是
Array
(
[name] => Indian Identity
[description] => Description from 'Ranjit Hoskote’s The Complicit Observer provides an art-historical account of Sudhir Patwardhan’s career, which spans over three decades and ranges across painting, drawing, township.
[clsfication] => this is classification
)
如何使用model->save()
,
答案 0 :(得分:2)
您可以使用PHP本机函数addslashes
代码:
$model->setAttributes([
'name' => addslashes('name'),
'description' => addslashes('description'),
'clsfication' => addslashes('clsfication'),
]);
$model->save();
答案 1 :(得分:0)
Array
(
[name] => Indian Identity
[description] => Description from 'Ranjit Hoskote\'s The Complicit Observer provides an art-historical account of Sudhir Patwardhan\'s career, which spans over three decades and ranges across painting, drawing, township.'
[clsfication] => this is classification
)
试试这个。并告诉我它是否有效。