<code>public function actionTestApply()
{
if (!Yii::app()->user->isGuest) {
$model = Apply::model()->findByPk($_POST['product_id']);
if (isset($_POST['LEMONCMS_CSRF_TOKEN'])) {
$model->test_text = $_POST['test_text'];
$model->img = $_POST['img'];
if ($model->save()) {
$this->redirect(array('user/apply'));
}
}
} else {
$this->render("error");
}
}
</code>能打印出 $model->test_text $model->img
<code>public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('user_id, product_id', 'required'),
array('user_id, product_id', 'numerical', 'integerOnly'=>true),
array('insert_time', 'safe'),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('id, user_id, insert_time, product_id', 'safe', 'on'=>'search'),
);
}
</code>
PbootCMS是一款高效、简洁、强悍的开源PHP企业网站开发建设管理系统。 PbootCMS 1.1.8 更新日志:2018-08-07 1.修复提交表单多选字段接收数据问题; 2.修复登录过程中二次登陆在页面不刷新时验证失败问题; 3.新增搜索结果fuzzy参数来控制是否模糊匹配; 4.新增父分类,顶级分类名称及链接独立标签,具体见手册; 5.新增内容多图拖动排序功能。
243
这是数据库
这是别人写的
<code>public function actionTestApply()
{
if (!Yii::app()->user->isGuest) {
$model = Apply::model()->findByPk($_POST['product_id']);
if (isset($_POST['LEMONCMS_CSRF_TOKEN'])) {
$model->test_text = $_POST['test_text'];
$model->img = $_POST['img'];
if ($model->save()) {
$this->redirect(array('user/apply'));
}
}
} else {
$this->render("error");
}
}
</code>能打印出 $model->test_text $model->img
<code>public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('user_id, product_id', 'required'),
array('user_id, product_id', 'numerical', 'integerOnly'=>true),
array('insert_time', 'safe'),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('id, user_id, insert_time, product_id', 'safe', 'on'=>'search'),
);
}
</code>这是数据库
这是别人写的
<code>php</code><code>if ($model->save()) {
$this->redirect(array('user/apply'));
}
</code>这一段我习惯写成
<code>php</code><code>if (!$model->save()) {
dump($model->errors);
}
$this->redirect(['user/apply']);
</code>这样如果没有save成功就会打印出错误了
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号