yyf
- yyf 回答了问题 关于文章如何上传到数据库同后台交互起来
使用同一个数据库。。。。
- yyf 赞了说说上海下雨
- yyf 2017-10-11 已签到连续签到1天,获得了5个金钱
- yyf 回答了问题 yii2 导出pdf
解决了改问题,是因为当文本比较长的时候,客户端在输入的时候使用了回车换行,所以导出的pdf不使用自动换行,会根据输入的换行符换行,造成字体很小,将文本中的换行符替换掉就可以了。 preg_replace('/\s/', '
', $info); - yyf 回答了问题 AR查询返回数据类型问题?
你使用了asArray()了吧,这个方法把查出的所有数据都返回了string类型,
你可以使用ArrayHelper::toArray(AR数据对象) - yyf 赞了回答
在你的apache 里面增加配置文件,将网站根目录指向到你的web 目录,重启apache即可
- yyf 赞了回答
源码参考yii\db\baseActiveRecord
protected function updateInternal($attributes = null) { if (!$this->beforeSave(false)) { return false; } $values = $this->getDirtyAttributes($attributes); if (empty($values)) { $this->afterSave(false, $values); return 0; } $condition = $this->getOldPrimaryKey(true); $lock = $this->optimisticLock(); if ($lock !== null) { $values[$lock] = $this->$lock + 1; $condition[$lock] = $this->$lock; } // We do not check the return value of updateAll() because it's possible // that the UPDATE statement doesn't change anything and thus returns 0. $rows = static::updateAll($values, $condition); if ($lock !== null && !$rows) { throw new StaleObjectException('The object being updated is outdated.'); } if (isset($values[$lock])) { $this->$lock = $values[$lock]; } $changedAttributes = []; foreach ($values as $name => $value) { $changedAttributes[$name] = isset($this->_oldAttributes[$name]) ? $this->_oldAttributes[$name] : null; $this->_oldAttributes[$name] = $value; } $this->afterSave(false, $changedAttributes); return $rows; }
$insert 表示是否是插入,changedAttributes显而易见可以知道,更新的时候被改变的attribute
- yyf 发表了说说开始上班了
- yyf 2017-10-09 已签到连续签到1天,获得了5个金钱