Skip to content

Instantly share code, notes, and snippets.

@toshimaru
Created July 7, 2012 09:41
Show Gist options
  • Save toshimaru/3065643 to your computer and use it in GitHub Desktop.
Save toshimaru/3065643 to your computer and use it in GitHub Desktop.
php get filename.
<?php
/**
* via: http://nanoca.me/relaxtyle/blog/2011/07/php-1.html
*/
// 現在表示されているファイル名取得
$path=$_SERVER["PHP_SELF"];
// パスつきのファイル名取得
$filename=basename($_SERVER["PHP_SELF"]);
// ファイル名のみ
$filename=basename($_SERVER["PHP_SELF"],".php");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment