mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
docs: file_exists to is_file
This commit is contained in:
parent
2b0af13348
commit
93a1c4dfeb
@ -67,7 +67,7 @@ Classmap
|
||||
========
|
||||
|
||||
The classmap is used extensively by CodeIgniter to eke the last ounces of performance out of the system
|
||||
by not hitting the file-system with extra ``file_exists()`` calls. You can use the classmap to link to
|
||||
by not hitting the file-system with extra ``is_file()`` calls. You can use the classmap to link to
|
||||
third-party libraries that are not namespaced::
|
||||
|
||||
$classmap = [
|
||||
|
@ -98,7 +98,7 @@ page actually exists:
|
||||
|
||||
public function view($page = 'home')
|
||||
{
|
||||
if ( ! file_exists(APPPATH.'/Views/pages/'.$page.'.php'))
|
||||
if ( ! is_file(APPPATH.'/Views/pages/'.$page.'.php'))
|
||||
{
|
||||
// Whoops, we don't have a page for that!
|
||||
throw new \CodeIgniter\Exceptions\PageNotFoundException($page);
|
||||
@ -116,7 +116,7 @@ footer, and displayed to the user. If the page doesn't exist, a "404
|
||||
Page not found" error is shown.
|
||||
|
||||
The first line in this method checks whether the page actually exists.
|
||||
PHP's native ``file_exists()`` function is used to check whether the file
|
||||
PHP's native ``is_file()`` function is used to check whether the file
|
||||
is where it's expected to be. The ``PageNotFoundException`` is a CodeIgniter
|
||||
exception that causes the default error page to show.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user