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.

23 lines
576 B

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'=>'login']);
  7. //输入
  8. $inputDate=[
  9. "name" => "kuangweijian",
  10. "password" => "123456546",
  11. ];
  12. $model->setAttributes($inputDate);
  13. // 输出
  14. if($model->validate()){
  15. echo "login succ".PHP_EOL;
  16. }else{
  17. echo "login failed".PHP_EOL;
  18. print_r($model->getErrors());
  19. }
  20. ?>