[wp-hackers] PHP one liner

Kitty kitty at mookitty.co.uk
Tue Dec 14 10:57:40 UTC 2004

Here's a quick bit of code to get the filename out of a URL/path:

Given $_SERVER['PHP_SELF'] == '/some/dir/index.php'

<?php $page = array_pop( explode( '/', $_SERVER['PHP_SELF'] ) ); ?>

$page will contain the 'index.php', no regexs, no fuss.
Cheers,		     Blog: http://blog.mookitty.co.uk
Kitty		     PC Repair: http://www.girltech.net
		     WP Plugins: http://mookitty.co.uk/devblog
Support proactive security: http://www.openbsd.org/orders.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : /pipermail/hackers_wordpress.org/attachments/20041214/2d0078de/attachment.bin

More information about the hackers mailing list