I have php files in My includes folder like this,
newclass.int.php
<?php
class NewClass extends ParentClass {
}
?>
parentclass.int.php
<?php
class ParentClass{
public $name = "Hey There!";
}
?>
and index.php
like this
<?php
include 'includes/parentclass.int.php';
include 'includes/newclass.int.php';
$object = new NewClass;
?>
<html>
<head>
<title>oop php</title>
</head>
<body>
<?php
echo $object->name;
?>
</body>
</html>
but I got following error msg when running the server Warning: include(includes/parentclass.int.php): failed to open stream: No such file or directory in C:\\wamp64\\www\\ooptest\\index.php on line 2
Warning: include(includes/newclass.int.php): failed to open stream: No such file or directory in C:\\wamp64\\www\\ooptest\\index.php on line 3
Fatal error: Uncaught Error: Class 'NewClass' not found in C:\\wamp64\\www\\ooptest\\index.php on line 4
Error: Class 'NewClass' not found in C:\\wamp64\\www\\ooptest\\index.php on line 4
how can I fix this problem?
The given error is shown because the file you are trying to include at line 2 doesn't exist under the specified path.
Make sure parentclass.int.php is situated in this path: C:\\wamp64\\www\\ooptest\\includes\\
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.