Home>Article>Backend Development> The difference between php use and include

The difference between php use and include

王林
王林 Original
2019-10-12 17:58:25 4488browse

The difference between php use and include

The difference between use and include in PHP

1. Include is an import file. If the file cannot be found, include will report a warning and continue. implement.

2. Use uses a namespace, which is equivalent to the import package in java. The premise is that the files in the package need to be required or included in advance.

When using, you need to write the full space name and class name later, such as the namespace Person1/Person; where Person1 is the namespace and Person is the class name.

Recommended tutorial:PHP video tutorial

The above is the detailed content of The difference between php use and include. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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