note 71093 added to function.require-once
| From: | rog_per at hotmail dot com | Date: | Sat, 11 Nov 2006 23:03:37 +0000 |
| Subject: | note 71093 added to function.require-once | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119616@lists.php.net to get a copy of this message | ||
When including a PHP file in Javascript, the array used by require_once is not updated.
<script language=javascript src="file.php"></script>
This results in a second load of the file at the next require_once:
<?php
require_once("file.php");
?>
How is it possible to tell the PHP require_once or include_once array that it has already been
loaded. For example a new command like...
mark_loaded("file.php");
I only found one solution on the problem, and it was to include a middle-file with the
require_once...
<script language=javascript
src="middle-file.php?file='file.php'"></script>
and here is the middle-file.php
<?php
require_once($GET['file']);
?>
Now the require_once array will be updated!!!!!!
Is there anyone else with another and better solution?
----
Server IP: 129.16.214.50
Probable Submitter: 213.89.66.70
----
Manual Page -- http://www.php.net/manual/en/function.require-once.php
Edit -- https://master.php.net/note/edit/71093
Del: integrated -- https://master.php.net/note/delete/71093/integrated
Del: useless -- https://master.php.net/note/delete/71093/useless
Del: bad code -- https://master.php.net/note/delete/71093/bad+code
Del: spam -- https://master.php.net/note/delete/71093/spam
Del: non-english -- https://master.php.net/note/delete/71093/non-english
Del: in docs -- https://master.php.net/note/delete/71093/in+docs
Del: other reasons-- https://master.php.net/note/delete/71093
Reject -- https://master.php.net/note/reject/71093
Search -- https://master.php.net/manage/user-notes.php