Answers for "server in php"

PHP
6

php server self

<form action="<?php echo $_SERVER['PHP_SELF']; ?>"> 
//there is no reason to use this to submit form data to the same page
<form action=""> 
//will do the same thing
Posted by: Guest on February-11-2020
5

php server name

echo $_SERVER['PHP_SELF'];
echo "<br>";
echo $_SERVER['SERVER_NAME'];
echo "<br>";
echo $_SERVER['HTTP_HOST'];
echo "<br>";
// echo $_SERVER['HTTP_REFERER'];
echo "<br>";
echo $_SERVER['HTTP_USER_AGENT'];
echo "<br>";
echo $_SERVER['SCRIPT_NAME'];
Posted by: Guest on May-04-2020
1

$_Server php

<?php
echo $_SERVER['PHP_SELF'];
echo "<br>";
echo $_SERVER['SERVER_NAME'];
echo "<br>";
echo $_SERVER['HTTP_HOST'];
echo "<br>";
echo $_SERVER['HTTP_REFERER'];
echo "<br>";
echo $_SERVER['HTTP_USER_AGENT'];
echo "<br>";
echo $_SERVER['SCRIPT_NAME'];
?>
Posted by: Guest on February-22-2021
1

php server

cd path/to/your/app
php -S 127.0.0.1:8000
Posted by: Guest on September-24-2020
2

$_Server php

<?php
echo $_SERVER['SERVER_NAME'];
?>
Posted by: Guest on February-22-2021
1

php server function

<?php
  // PHP $_SERVER['...']; method
  
  // PHP file name
  echo 'PHP file name: '.$_SERVER['PHP_SELF'].'<br>';
  // Server name
  echo 'Server name: '.$_SERVER['SERVER_NAME'].'<br>';
  // HTTP host
  echo 'HTTP host: '.$_SERVER['HTTP_HOST'].'<br>';
  // Refering link
  echo 'Refering link: '.$_SERVER['HTTP_REFERER'].'<br>';
  // User agent
  echo 'User agent: '.$_SERVER['HTTP_USER_AGENT'].'<br>';
  // Script name
  echo 'Script name: '.$_SERVER['SCRIPT_NAME'];
  
  // The rest is optional

  if($_SERVER['PHP_SELF']=='/filename.php'){
    //If there is no folder
    echo 'No folder'.$_SERVER['PHP_SELF'];
  } else{
    // Echo the name of the folder containing the PHP file
    echo 'PHP file name: '.$_SERVER['PHP_SELF'];
  }
  
  // The same if statements can be used for the script name
  
  if($_SERVER['SCRIPT_NAME']=='/filename.php'){
    // If there is no folder
    echo 'No folder'.$_SERVER['SCRIPT_NAME'];
  } else{
    // Echo the name of the folder containing the PHP file
    echo 'PHP file name: '.$_SERVER['SCRIPT_NAME'];
  }
  
  echo '<a href="repl.it/@CoolWebDev">More from me...</a>';
  
  // I hope you found this helpful! 
?>
Posted by: Guest on July-06-2020

Browse Popular Code Answers by Language