From 93a1c4dfebb955c1b3bf4685f6863e9496792c24 Mon Sep 17 00:00:00 2001 From: ytetsuro Date: Wed, 28 Nov 2018 01:48:41 +0900 Subject: [PATCH] docs: file_exists to is_file --- user_guide_src/source/concepts/autoloader.rst | 2 +- user_guide_src/source/tutorial/static_pages.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/concepts/autoloader.rst b/user_guide_src/source/concepts/autoloader.rst index 300200bc30..8ceaffeb2c 100644 --- a/user_guide_src/source/concepts/autoloader.rst +++ b/user_guide_src/source/concepts/autoloader.rst @@ -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 = [ diff --git a/user_guide_src/source/tutorial/static_pages.rst b/user_guide_src/source/tutorial/static_pages.rst index c5d6644622..c8a408eaea 100644 --- a/user_guide_src/source/tutorial/static_pages.rst +++ b/user_guide_src/source/tutorial/static_pages.rst @@ -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.