PHP项目开发框架,基于composer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
676 B

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <?php
  2. namespace wiggins\myProject\example;
  3. require __DIR__.'/../vendor/autoload.php';
  4. require __DIR__.'/../vendor/yiisoft/yii2/Yii.php';
  5. use wiggins\myProject\models\UserInput;
  6. $model=new UserInput(['scenario'=>'register']);
  7. //输入
  8. $inputDate=[
  9. "name" => "kuangweijian",
  10. "email" => "12345678@qq.com",
  11. "password" => "1234567890",
  12. "pwdConfirm"=> "1234567890",
  13. ];
  14. $model->setAttributes($inputDate);
  15. //输出
  16. if($model->validate()){
  17. echo "register succ".PHP_EOL;
  18. }else{
  19. echo "register failed".PHP_EOL;
  20. print_r($model->getErrors());
  21. }
  22. ?>