How to use require in PHP? ? Can't there be functions in external files? ?

WBOY
Release: 2016-08-18 09:16:35
Original
1562 people have browsed it

There is a function test in an external file demo1.php and an echo '000000';
require 'demo1.php' in another file demo2.php; echo '1111111';
Why do I call test in demo2 ( ), the following content within this field is not displayed? 1111111 is not displayed
not called, normal

Reply content:

There is a function test in an external file demo1.php and an echo '000000';
require 'demo1.php' in another file demo2.php; echo '1111111';
Why do I call test in demo2 ( ), the following content within this field is not displayed? 1111111 is not displayed
not called, normal

1 show me the code!

2 Turn on php error debugging. This should indicate that some error has occurred. You will know after typing out the error log.

How can the require 'demo1.php' be loaded if it is not in the same folder? The path must be written correctly

There may be errors in demo1, or demo1 may not exist.
It could also be your single quotes and semicolons.

It should be a Fatal error. You can turn on error reporting
error_reporting(E_ALL);
ini_set('display_errors', 'On')

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template