I'm trying to run a function but only on specific pages. I thought this would be fine...
$allowed_pages = array('/admin/update.php', '/admin/system.php', '/admin/install.php');
if($_SERVER['SCRIPT_NAME'] == $allowed_pages) {
myCoolFuntion();
}
...but it doesn't seem to work as expected and the myCoolFuntion()
runs regardless of what page I am on.
If I echo $_SERVER['SCRIPT_NAME']
on any given page, I can see it does match up correctly (it matches a page specified in the array, for example, /admin/update.php
as expected) and so I know the values in the array are in the correct format.
What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire