note 120303 added to function.include

From: Date: Thu, 08 Dec 2016 16:58:22 +0000
Subject: note 120303 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-208284@lists.php.net to get a copy of this message
sometimes one has to run the same script both on the shell and on a server, so it is necessary to know, where the included file is in relation to the working directory. a simple workaround can help: <?php $dir_work = getcwd(); $dir_file = ""; if ($dir != "directory on the server") { $dir_file = "directory in relation to php.exe"; // for shell } include ($dir_file . $file); ---- Server IP: 72.52.91.14 Probable Submitter: 77.179.87.78 ---- Manual Page -- http://php.net/manual/en/function.include.php Edit -- https://master.php.net/note/edit/120303 Del: integrated -- https://master.php.net/note/delete/120303/integrated Del: useless -- https://master.php.net/note/delete/120303/useless Del: bad code -- https://master.php.net/note/delete/120303/bad+code Del: spam -- https://master.php.net/note/delete/120303/spam Del: non-english -- https://master.php.net/note/delete/120303/non-english Del: in docs -- https://master.php.net/note/delete/120303/in+docs Del: other reasons-- https://master.php.net/note/delete/120303 Reject -- https://master.php.net/note/reject/120303 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#208284) next »