What it’s for and how to use include_path in php

Asked

Viewed 1,172 times

2

I have picked up many scripts using include_path, the problem is that the explanation of php.net I find a little confusing, I’m not getting to understand how it works and what it’s for, help me Please

1 answer

2

In simple terms it allows you to use one of these functions: require, include, fopen(), file(), readfile() and file_get_contents(), you do not need to enter the full path, once you have entered the file name, php will search the existing folders inside the include_path.

The explanation of the documentation is below:

"Specifies the list of directories where require, include, fopen(), file(), readfile() and file_get_contents() functions by files. The format is equal to the PATH environment variable: a list of directories separated by comma in Unix and dot and comma in Windows.

PHP considers expensive item in include_path separately when looking for files to include. It will check the first path, and if it does not find it here, it will search the next one and so on, until it finds the file or returns a Warning or error. You can modify the include_path during execution using set_include_path()."

Reference

Browser other questions tagged

You are not signed in. Login or sign up in order to post.