Yii Framework Forum: [Error] failed to open stream: No such file or directory (YiiBase.php) - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Error] failed to open stream: No such file or directory (YiiBase.php) Rate Topic: -----

#1 User is offline   naimad 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 21-February 18

Posted 21 February 2018 - 08:11 AM

Hi! I have a simple login:

<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'LoginForm',
    'enableClientValidation'=>true,
    'clientOptions'=>array('validateOnSubmit'=>true,),)); ?>

<div class="container">
    <div class="form-signin">
        <h2 class="form-signing-heading">Login</h2>
        <label for="inputUsuario" class="sr-only">
            Usuario
        </label>
        <?php echo $form->textField($model,'username',array('class'=>"form-control",'placeholder'=>"Usuario",'id'=>"username")); ?>
        <label for="inputPassword" class="sr-only">
            Password
        </label>
        <?php echo $form->passwordField($model,'password',array('class'=>"form-control",'placeholder'=>"Password",'id'=>"password", 'name'=>"password")); ?>
        <br>
        <?php echo CHtml::Button('Entrar',array("class"=>"btn btn-lg btn-primary btn-block","onclick"=>"login()")); ?>
        <?php $this->endWidget(); ;?>
    </div>
</div>


The login calls a controller via AJAX:

<script>
    function login(){
        debugger;
        var usuario  = $('#username').val();
        var password = $('#password').val();
        if(usuario == "" || usuario == null || password == "" || password == null){
            alert('Ingrese los datos');
        }
        else{
            var data = {'usuario':usuario, 'password':password};
            $.ajax({
                url: 'login',
                type: "POST",
                data: data,
                dataType: "html",
                cache: false,
                success: function (response){
                    alert(response);
                    if(response == 'error'){
                        alert('Error al loguear');
                    }
                    else{
                        alert("do something");
                    }
                }
            });
        }
    }
</script>


I have this problem:

Quote

2018/02/21 13:46:53 [error] [php] include(Yi.php): failed to open stream: No such file or directory (C:\xampp\htdocs\casa-licata\framework\YiiBase.php:432)
Stack trace:
#0 C:\xampp\htdocs\casa-licata\protected\controllers\SiteController.php(97): spl_autoload_call()
#1 C:\xampp\htdocs\casa-licata\framework\web\actions\CInlineAction.php(49): SiteController->actionLogin()
#2 C:\xampp\htdocs\casa-licata\framework\web\CController.php(308): CInlineAction->runWithParams()
#3 C:\xampp\htdocs\casa-licata\framework\web\CController.php(286): SiteController->runAction()
#4 C:\xampp\htdocs\casa-licata\framework\web\CController.php(265): SiteController->runActionWithFilters()
#5 C:\xampp\htdocs\casa-licata\framework\web\CWebApplication.php(282): SiteController->run()
#6 C:\xampp\htdocs\casa-licata\framework\web\CWebApplication.php(141): CWebApplication->runController()
#7 C:\xampp\htdocs\casa-licata\framework\base\CApplication.php(185): CWebApplication->processRequest()
#8 C:\xampp\htdocs\casa-licata\index.php(13): CWebApplication->run()
REQUEST_URI=/casa-licata/site/login
in C:\xampp\htdocs\casa-licata\protected\controllers\SiteController.php (97)
in C:\xampp\htdocs\casa-licata\index.php (13)



┬┐Any sugesstion?

I searched all the posible solutions but i dont have lucky.

Thanks, Regards
0

#2 User is offline   naimad 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 21-February 18

Posted 21 February 2018 - 09:37 AM

I solved it, the problem was i have two "echo" on the controller.


Now, my problem it's the response is my "echo" + all the html.


Why?? :blink:
0

#3 User is offline   naimad 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 21-February 18

Posted 22 February 2018 - 03:28 PM

I solved it.

The problem was on the controller. You must put else, before the render.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users