Merge pull request #5 from DaveRandom/absolute-include-paths
Always use absolute paths for includes
This commit is contained in:
commit
7173cbb6b6
2 changed files with 3 additions and 3 deletions
|
@ -19,7 +19,7 @@ Inside the `public` folder you can now create your `index.php`. Remember that yo
|
|||
```php
|
||||
<?php
|
||||
|
||||
require '../src/Bootstrap.php';
|
||||
require __DIR__ . '/../src/Bootstrap.php';
|
||||
```
|
||||
|
||||
The `Bootstrap.php` will be the file that wires your application together. We will get to it shortly.
|
||||
|
|
|
@ -21,7 +21,7 @@ To install a new package, open up your `composer.json` and add the package to th
|
|||
|
||||
Now run `composer update` in your console and it will be installed.
|
||||
|
||||
But you can't use it yet. PHP won't know where to find the files for the classes. For this you will need an autoloader, ideally a [PSR-4](http://www.php-fig.org/psr/psr-4/) autoloader. Composer already takes care of this for you, so you only have to add a `require '../vendor/autoload.php';` to your `Bootstrap.php`.
|
||||
But you can't use it yet. PHP won't know where to find the files for the classes. For this you will need an autoloader, ideally a [PSR-4](http://www.php-fig.org/psr/psr-4/) autoloader. Composer already takes care of this for you, so you only have to add a `require __DIR__ . '/../vendor/autoload.php';` to your `Bootstrap.php`.
|
||||
|
||||
**Important:** Never show any errors in your production environment. A stack trace or even just a simple error message can help someone to gain access to your system. Always show a user friendly error page instead and send an email to yourself, write to a log or something similar. So only you can see the errors in the production environment.
|
||||
|
||||
|
@ -34,7 +34,7 @@ Then after the error handler registration, throw an `Exception` to test if every
|
|||
|
||||
namespace Example;
|
||||
|
||||
require '../vendor/autoload.php';
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
|
|
Loading…
Reference in a new issue