Home > Backend Development > PHP Tutorial > Usage of PHP_SELF and basename_PHP tutorial

Usage of PHP_SELF and basename_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:30:47
Original
820 people have browsed it

$php_self = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];

if ('/' == substr($php_self, -1)){

    $php_self .= 'index.php';

}

define('PHP_SELF', $php_self);
Copy after login

If

echo basename(PHP_SELF)
Copy after login

is displayed as: index.php

If

echo basename(PHP_SELF,'.php')
Copy after login

Displayed as: index

Articles you may be interested in

  • php finds whether a value exists in an array (in_array(), array_search(), array_key_exists() )
  • phpMyAdmin Cannot start session without errors error solution
  • php prompts Maximum execution time of 30 seconds exceeded... Error solution
  • PHP reports Fatal error Allowed memory size of...How to solve the out of memory error
  • Detailed explanation of PHP string escape functions (addslashes, stripslashes)
  • php prompt PHP Warning: date(): It is not safe to Rely on the... Error solution
  • The usage and difference of using break, continue, goto, return, exit to break out of multiple loops in PHP
  • php string replacement function str_replace Faster than preg_replace

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764199.htmlTechArticle$php_self = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER ['SCRIPT_NAME'];if ('/' == substr($php_self, -1)){ $php_self .= 'index.php';}define('PHP_SELF', $php_self);...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template