There are 2 php files. It is necessary to use the variable from the first file in the second, but at the same time so that the first file itself is not executed during the execution of the second one. How to achieve this?
|
3 answers
Save the variable in the session, read here
in the first file
<?php session_start() $var="value"; $_SESSION['var']=$var;
in the second file
<?php session_start() $var=$SESSION['var'] //теперь переменная $var равна 'value'
- oneDo not torture 1gig of information in a shooter? - Aios
- onewhere does one gig in a variable come from? (do not torture one gig into a variable to shove?) - zb '12
|
to transfer the algorithm for obtaining this very “variable” to the second file - and if the implementation of this algorithm takes up the entire first file, then alas, without “not executed” it will not work
Maybe more specifics? Well, there is a problem) - maybe it can be solved in other ways
- The first file loads the image from the form. I actually need the file name further in the second file - for example, to write to the database. everything would be nothing, but ajax is bolted to the first file (output of the loaded image to the screen). - Timmi55 pm
- in the session variable write - zb '11
- oneIn general, practice shows that the data on the downloaded file is best saved immediately in the database table. There are fewer problems, especially if the project develops further. ---------- From practice: The customer wanted the CNC of the file names in the transliteration after six months of the project, and the real file names are equal to md5sum - Gedweb
|
You can also save cookies:
bool setcookie (string name [, string value [, int expire etc)
name - the name of the cookie to be set; value - the value stored in the cookie named $ name;
|