I have a php file in other directory and i wanna use some data of it,but when i require_once() the file i see this error:
Fatal error: require_once(): Failed opening required '/Controller/UserController' (include_path='.;C:\php\pear') in E:\wamp\www\newmvc\index.php on line 20
newmvc is my root and i'm sure there is no misspelling and i have the file.
$Controller="user";
$param=array();
$className=ucfirst($Controller)."Controller";
$controllerfilepath="/Controller/".$className;
require_once "$controllerfilepath";
I suppose you forgot to add an extension .php
for class filename:
$controllerfilepath="/Controller/" . $className . ".php";