文件意外结束

unexpected end of file

我遇到了意外的文件结束错误,但我检查了我的代码,没有发现任何此错误的迹象!那么你能告诉我这个问题可能是什么原因造成的吗!这是我的文件代码,其中包含错误(这是一个用 cakephp 完成的项目):

<?php
     App::uses('AppController', 'Controller');

     class AdminsController extends AppController {

  public function login($id = null) 
{       


    $this->layout='login';


    if ($this->request->is('post')) {

        $user=$this->request->data['Admin']['r'];



        if ($user == 'Administrator')
        {   
            $Admin=$this->request->data['Admin']['login'];
            $mdp=$this->request->data['Admin']['motpasse'];

            $Admins=$this->Admin->find('count',array('conditions'=>array('Admin.login'=>$Admin,'Admin.motpasse'=>$mdp)));

            if ($Admins ==1) 
                {sleep(2);
                    CakeSession::write('admin','admin' );
                    CakeSession::write('nom',$Admin);
                    $this->redirect(array('action' => 'index'));

                }else {?><script type="text/javascript">
                confirm('M.Admin Login ou Mot de passe incorrect');
            </script><?}

        }


        if ($user == 'Commercial')
        {   
            App::Import('Model', 'Commercial'); 

            $Admin=$this->request->data['Admin']['login'];
            $mdp=$this->request->data['Admin']['motpasse'];

            $category = new Commercial(); 
            $categories = $category->find('count',array('conditions'=>array('Commercial.login'=>$Admin,'Commercial.motpasse'=>$mdp))); 

            if ($categories ==1) 
            { 
                CakeSession::write('admin','com' );
                CakeSession::write('nom',$Admin);
                $this->redirect(array('controller' => 'Commercials', 'action' => ''));
            }

        }
    }
}



 public function logout($id = null) 
{    
    $this->Session->destroy();
    $this->redirect(array('action' => 'login'));




}


  public function index() {

$admin=CakeSession::read('admin');
if(($admin<>'admin')&&($admin<>'com'))
    {$this->redirect(array('controller' => 'Admin', 'action' => 'login'));}

if($admin=='com')
    {$this->layout='Commercials';}

$this->Admin->recursive = 0;
$this->set('admins', $this->paginate());
    }


    public function view($id = null) {

$admin=CakeSession::read('admin');
if(($admin<>'admin')&&($admin<>'com'))
    {$this->redirect(array('controller' => 'Admin', 'action' => 'login'));}

if($admin=='com')
    {$this->layout='Commercials';}

if (!$this->Admin->exists($id)) {
    throw new NotFoundException(__('Invalid admin'));
}
$options = array('conditions' => array('Admin.' . $this->Admin->primaryKey => $id));
$this->set('admin', $this->Admin->find('first', $options));
   }


   public function add() {

$admin=CakeSession::read('admin');
if(($admin<>'admin')&&($admin<>'com'))
    {$this->redirect(array('controller' => 'Admin', 'action' => 'login'));}

if($admin=='com')
    {$this->layout='Commercials';}

if ($this->request->is('post')) {
    $this->Admin->create();
    if ($this->Admin->save($this->request->data)) {
        $this->Session->setFlash(__('The admin has been saved'));
        $this->redirect(array('action' => 'index'));
    } else {
        $this->Session->setFlash(__('The admin could not be saved. Please, try again.'));
    }
}
$questionnaires = $this->Admin->Questionnaire->find('list');
$this->set(compact('questionnaires'));
   }


    public function delete($id = null) {

$admin=CakeSession::read('admin');
if(($admin<>'admin')&&($admin<>'com'))
    {$this->redirect(array('controller' => 'Admin', 'action' => 'login'));}

if($admin=='com')
    {$this->layout='Commercials';}

$this->Admin->id = $id;
if (!$this->Admin->exists()) {
    throw new NotFoundException(__('Invalid admin'));
}
$this->request->onlyAllow('post', 'delete');
if ($this->Admin->delete()) {
    $this->Session->setFlash(__('Admin deleted'));
    $this->redirect(array('action' => 'index'));
}
$this->Session->setFlash(__('Admin was not deleted'));
$this->redirect(array('action' => 'index'));
   }
   }
   ?>

这是出现的错误:

看看这里:

if ($Admins ==1) 
            {sleep(2);
                CakeSession::write('admin','admin' );
                CakeSession::write('nom',$Admin);
                $this->redirect(array('action' => 'index'));

            }else {?><script type="text/javascript">
            confirm('M.Admin Login ou Mot de passe incorrect');
        </script><? } // look at here
        ?>

应该是:

if ($Admins ==1) 
            {sleep(2);
                CakeSession::write('admin','admin' );
                CakeSession::write('nom',$Admin);
                $this->redirect(array('action' => 'index'));

            }else {?><script type="text/javascript">
            confirm('M.Admin Login ou Mot de passe incorrect');
        </script><?php } // your little mistake was here
       ?>

你有没有注意到你 php 不见了。