Added some texts regarding external php scripts (#30419)
and calling them using include and require
This commit is contained in:
committed by
Randell Dawson
parent
f0524ad9f9
commit
a585eef1f7
@ -20,12 +20,25 @@ A PHP script starts with `<?php` and ends with `?>`:
|
|||||||
?>
|
?>
|
||||||
```
|
```
|
||||||
or
|
or
|
||||||
you can also write A PHP script starts with `<?php` and ends without `?>`:
|
you can also write A PHP script which starts with `<?php` and ends without `?>` when writing it in an external file i.e. "filename.php":
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
// PHP code goes here
|
// PHP code goes here
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The code can later be called using include:
|
||||||
|
```php
|
||||||
|
<?php
|
||||||
|
include 'filename.php';
|
||||||
|
?>
|
||||||
|
```
|
||||||
|
or
|
||||||
|
using require
|
||||||
|
```php
|
||||||
|
<?php
|
||||||
|
require 'filename.php';
|
||||||
|
?>
|
||||||
|
```
|
||||||
|
|
||||||
Below, we have an example of a simple PHP file, with a PHP script that uses a built-in PHP function "echo" to output the text "Hello World!" on a web page:
|
Below, we have an example of a simple PHP file, with a PHP script that uses a built-in PHP function "echo" to output the text "Hello World!" on a web page:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user