我正在使用MVC架構在使用PHP項目。在我的項目文件中,我有index.php
文件以及model
文件夾,controller
文件夾和view
*文件夾。包含控制器在php代碼中的查看文件
在我的索引文件,我已經寫了這個代碼:
`<?php
include("./controller/controllerUser.php");
$ocont = new controllerUser();
if (isset($_GET['action']) && !empty($_GET['action'])) {
$ocont->{$_GET['action']}();
}
?>`
的controllerUser(位於控制器文件夾內)的網站重定向到我ViewLogin文件(位於視圖內文件夾),直到這裏都工作正常。
問題是,當我點擊註冊按鈕在我viewLogin
文件,將其重定向我到ViewSignup
文件(位於view
文件夾中),但我得到這些錯誤:
Warning: include(..\Model\controllerUser.php) [function.include]: failed to open stream: No such file or directory in D:\wamp\www\projetphp\view\ViewSignup.php on line 45
Warning: include() [function.include]: Failed opening '.\controller\controllerUser.php' for inclusion (include_path='.;C:\php\pear') in D:\wamp\www\projetphp\view\viewSignup.php on line 45
Fatal error: Class 'controllerUser' not found in D:\wamp\www\projetphp\view\ViewSignIn.php on line 51
我想問題是在ViewSignup
頁面的PHP代碼中包含controllerUser
文件。
這是我的代碼:
include ('.\controller\controllerUser.php');
$ocontuser = new controllerUser();
$ocontuser->Actions2_SignIn();
我想這太,卻得到了更多的錯誤:
include ('..\controller\controllerUser.php');
$ocontuser = new controllerUser();
$ocontuser->Actions2_SignIn();
我應該做些什麼來解決這個問題?