$username=$this->username?:'someone';$email=$this->email?:Yii::$app->params['adminEmail'];$password=Yii::$app->getSecurity()->generatePasswordHash($this->password?:'xx');$table=User::tableName();$auth_key=Yii::$app->security->generateRandomString();$status=User::STATUS_ACTIVE;$timestamp=time();$god=1;$words="inthe${table}hasarecordwhichcontainssomevalue:";$words.="'${username}','${email}','${password}','${auth_key}','${status}','${timestamp}','${god}','${timestamp}','${god}'";上面的word怎样拼凑才能优雅些?
2 回答
呼啦一阵风
TA贡献1802条经验 获得超6个赞
sprintf是个不错的方案不过看你的代码感觉就是像把各种变量都打出来调试用,那么有个神器get_defined_vars,变量名变量值都有了你值得拥有
添加回答
举报
0/150
提交
取消