Php: Difference between revisions

From Server STB
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:


* Contoh menampilkan ip address server
* Contoh menampilkan ip address server
   <?php
   <?php
   $command = 'ip addr show eth0 | grep -oP "inet \K[\d.]*"';
   $command = 'ip addr show eth0 | grep -oP "inet \K[\d.]*"';
Line 9: Line 8:
   echo $host;
   echo $host;
   ?>
   ?>
== Koneksi ==
== Koneksi ==
Database
Database

Revision as of 12:23, 13 January 2024

PHP

  • Contoh menampilkan ip address server
 <?php
 $command = 'ip addr show eth0 | grep -oP "inet \K[\d.]*"';
 $ipaddr = shell_exec($command);
 $host = trim($ipaddr);
 echo $host;
 ?>

Koneksi

Database

API

web