Как выполнить PHP-скрипт на веб-сайте с помощью веб-сервера XAMPP?
Опубликовано: 20 Февраля, 2022
Сначала нам нужно установить веб-сервер XAMPP / WAMP в нашей системе. Пожалуйста, перейдите по ссылке, чтобы загрузить и установить сервер XAMPP / WAMP. Ссылка https://www.apachefriends.org/download.html
After successful installation, the steps we should follow are-
- Open XAMPP control panel, if you want to link database to your code then start MySQL otherwise you will need to start Filezilla and Apache

Xampp starts
- Then open Notepad/Notepad++ or any text editor to write PHP program.
PHP
<?php echo "Geeks for Geeks" ; ?> |
- Save you file in path xampp/htdocs/gfg/a.php
- Затем перейдите в свой браузер и введите localhost / gfg / a.php в разделе URL. Он отобразит результат.
Note: If there are multiple files in your code similarly then you can put all your files in one folder and can run it.
PHP
<?php // Declare the variable $x = 20; $y = 10; // Evaluate arithmetic operations $z = $x + $y ; $m = $x - $y ; $p = $x * $y ; $a = $x / $y ; // Addition echo "Sum: " , $z ; // Sum: 30 // Subtraction echo "Diff: " , $m ; // Diff: 10 // Multiplication echo "Mul: " , $p ; // Mul: 200 // Division echo "Div: " , $a ; // Div: 2 ?> |
Введите URL-адрес xampp / htdocs / gfg / code / 1.php в браузере, он отобразит результат.