Sign up for Free !!
World's first open source developer community with
Ticketing System
Recently I have been working on php pages...
So I am not clear whether it is possible to include php files into other files or not...
So any help will be appreciated...
Let's say you have 2 .php files called: index.php and functions.php. If it's mandatory that functions.php is included inside index.php, use require, or require_once
If it's not mandatory that functions.php is included inside index.php, use include of include_once. Be sure to use relative paths. For relative paths, use: dirname(__DIR__).'/functions.php', with include / include_once or require/require_once Resources: include (https://www.php.net/manual/ro/function.include.php) include_once (https://www.php.net/manual/ro/function.include-once.php) require (https://www.php.net/manual/ro/function.require.php) require_once (https://www.php.net/manual/ro/function.require-once.php) relative_path (stackoverflow.com) (https://stackoverflow.com/questions/17407664/php-include-relative-path)
dirname(__DIR__).'/functions.php', with include / include_once or require/require_once
Please Login/Register to write your answer !!!
Let's say you have 2 .php files called: index.php and functions.php.
If it's mandatory that functions.php is included inside index.php, use require, or require_once
If it's not mandatory that functions.php is included inside index.php, use include of include_once.
Be sure to use relative paths.
For relative paths, use:
dirname(__DIR__).'/functions.php', with include / include_once or require/require_once
Resources:
include (https://www.php.net/manual/ro/function.include.php)
include_once (https://www.php.net/manual/ro/function.include-once.php)
require (https://www.php.net/manual/ro/function.require.php)
require_once (https://www.php.net/manual/ro/function.require-once.php)
relative_path (stackoverflow.com) (https://stackoverflow.com/questions/17407664/php-include-relative-path)