PHP_SELF and basename usage

Source: Internet
Author: User
Tags exit in

$ 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 );

If

Echo basename (PHP_SELF)

Displayed as index. php

If

Echo basename (PHP_SELF, '. php ')

Displayed as: index

Articles you may be interested in
  • Php searches for the existence of a value in the 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... solution to the error
  • PHP reports Fatal error Allowed memory size of... how should we solve the problem of insufficient memory?
  • PHP string escape functions (addslashes, stripslashes)
  • Php prompts PHP Warning: date (): It is not safe to rely on the... solution to the error
  • Use break, continue, goto, return, and exit in multiple loops in PHP
  • Php string replacement function str_replace is faster than preg_replace

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.