note 129744 added to function.spl-autoload-register

From: Date: Wed, 11 Sep 2024 05:27:30 +0000
Subject: note 129744 added to function.spl-autoload-register
Groups: php.notes 
Request: Send a blank email to php-notes+get-221526@lists.php.net to get a copy of this message
My solution for running SPL on different OS/FS case-sensitive or case-insensitive <?php // for Windows if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { spl_autoload_extensions('.php'); spl_autoload_register(); // register spl_autoload() } else { // for other: Linux, ... spl_autoload_register( function ($class_name) { require_once $_SERVER['DOCUMENT_ROOT'].'/'.str_replace('\\', '/', $class_name).'.php'; } ); } ?> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 212.90.59.36) ---- Manual Page -- https://php.net/manual/en/function.spl-autoload-register.php Edit -- https://main.php.net/note/edit/129744 Del: integrated -- https://main.php.net/note/delete/129744/integrated Del: useless -- https://main.php.net/note/delete/129744/useless Del: bad code -- https://main.php.net/note/delete/129744/bad+code Del: spam -- https://main.php.net/note/delete/129744/spam Del: non-english -- https://main.php.net/note/delete/129744/non-english Del: in docs -- https://main.php.net/note/delete/129744/in+docs Del: other reasons-- https://main.php.net/note/delete/129744 Reject -- https://main.php.net/note/reject/129744 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221526) next »