Beste,
ik gebruik een wegserver van Apache/2.4.18 en PHP/7.0.2 op mijn macbooktpro
Nu ben ik een cursus aan het volgen van udemy. maar op een punt komt ik een error tegen :
Fatal error: require_once(): Failed opening required 'Core.php'
kan dit aan de versie van php liggen ?
index.php
<script>
<?php
require_once('inc/autoload.php');
$core1 = new Core();
$core1->run();
?>
</script>
autoload.php
<script>
<?php
require_once('_config.php');
function __autoload($class_name) {
$class = explode("_", $class_name);
$path = implode("/", $class).".php";
require_once($path);
}
?>
</script>
_config.php
<script>
<?php
if(!isset($_SESSION)) {
session_start();
}
// site domain name with http
defined("SITE_URL")
|| define("SITE_URL", "http://".$_SERVER['SERVER_NAME']);
// directory separator
defined("DS")
|| define("DS", DIRECTORY_SEPARATOR);
// root path
defined("ROOT_PATH")
|| define("ROOT_PATH", realpath(dirname(__FILE__).DS."..".DS));
// classes folder
defined("CLASSES_DIR")
|| define("CLASSES_DIR", "classes");
// pages directory
defined("PAGES_DIR")
|| define("PAGES_DIR", "pages");
// modules folder
defined("MOD_DIR")
|| define("MOD_DIR", "mod");
// inc folder
defined("INC_DIR")
|| define("INC_DIR", "inc");
// template folder
defined("TEMPLATE_DIR")
|| define("TEMPLATE_DIR", "template");
// emails path
defined("EMAILS_PATH")
|| define("EMAILS_PATH", ROOT_PATH.DS."emails");
// catalogue images path
defined("CATALOGUE_PATH")
|| define("CATALOGUE_PATH", ROOT_PATH.DS."media".DS."catalogue");
// add all above directories to the include path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(ROOT_PATH.DS.CLASSES_DIR),
realpath(ROOT_PATH.DS.PAGES_DIR),
realpath(ROOT_PATH.DS.MOD_DIR),
realpath(ROOT_PATH.DS.INC_DIR),
realpath(ROOT_PATH.DS.TEMPLATE_DIR),
get_include_path()
)));
?>
</script>
Core.php
<script>
<?php
class core {
public function run() {
echo "hi from within run method";
}
}
?>
</script>
Kan iemand mij hier bij helpen ?
met vriendelijke groeten
Johan
[size=xsmall]Toevoeging op 28/08/2016 12:08:14:[/size]
als ik deze uitvoer krijg ik de melding:
Warning: require_once(Core.php): failed to open stream: No such file or directory in /Users/JohanCuypers/Sites/Udemy/inc/autoload.php on line 7
Fatal error: require_once(): Failed opening required 'Core.php' (include_path='/Users/JohanCuypers/Sites/Udemy/classes:/Users/JohanCuypers/Sites/Udemy/pages:/Users/JohanCuypers/Sites/Udemy/mod:/Users/JohanCuypers/Sites/Udemy/inc:/Users/JohanCuypers/Sites/Udemy/template:.:/usr/local/php5/lib/php') in /Users/JohanCuypers/Sites/Udemy/inc/autoload.php on line 7
6.363 views
