Below is my test project
db.php
- Code: Select all
<?php
function greeting() {
echo "Ciao";
}
inc.php
- Code: Select all
<?php
require 'db.php';
index.php
- Code: Select all
<?php
require 'inc.php';
admin/index.php
- Code: Select all
<?php
require '../inc.php';
Everything seems fine. The code run well on http://localhost/test/index.php, the greeting is echoed.
But when browsing to http://localhost/test/admin/index.php, XAMPP returns a fatal error:
Fatal error: Call to undefined function greeting() in D:\xampp\htdocs\test\admin\index.php on line 5
This error not orcur when I rename db.php to functions.php
How to fix that?