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
666 B

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\UserInput;
  6. $model=new UserInput(['scenario'=>'register']);
  7. $inputDate=[
  8. "UserInput"=>[
  9. "name" => "kuangweiian",
  10. "email" => "12345678@qq.com",
  11. "password" => "1234567890",
  12. "pwdConfirm"=> "1234567890",
  13. ]
  14. ];
  15. $model->load($inputDate);
  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. ?>