I want to transfer the value of the $ x variable from the getdata.php file to the html tag of the data.php file
In this case, the file getdata.php is located in the php directory, and the data.php file is in the server root.
I tried to do this:
File code getdata.php
<?php $x = 'ΠΡΠΈΠ²Π΅Ρ ΠΌΠΈΡ!'; require_once('../data.php'); ?>
The code of the data.php file
<html> <head> </head> <body> <div>ΠΠ΅ΡΠ΅ΠΌΠ΅Π½Π½Π°Ρ ΠΈΠ· php: <span><?php echo $x; ?></span> </div> </body> </html>
Nothing is displayed.
I tried to do this:
File code getdata.php
<?php $x = 'ΠΡΠΈΠ²Π΅Ρ ΠΌΠΈΡ!'; ?>
The code of the data.php file
<? include_once "php/getdata.php"; ?> <html> <head> </head> <body> <div>ΠΠ΅ΡΠ΅ΠΌΠ΅Π½Π½Π°Ρ ΠΈΠ· php: <span><?php echo $x; ?></span> </div> </body> </html>
Nothing is output and the following occurs: Warning: include_once (php / getdata.php): Wow: \ domains \ test \ data.php on line 1
Warning: include_once (): Failed opening 'php / getdata.php' for inclusion (include_path = '; w: / modules/php/PHP-7.2-x64; w: /modules/php/PHP-7.2-x64/PEAR / pear ') in W: \ domains \ test \ data.php on line 1
Tell me please, what am I doing wrong?
include_once "/php/getdata.php";
for a start, the last.php
superfluous, and the first slash is needed to access the file from the root of the "site", but here I can be misled, because I am not a theorist, I could forget everything for a long time - DaemonHKinclude_once __DIR__ . "/php/getdata.php";
orchdir(__DIR__); include_once "php/getdata.php";
chdir(__DIR__); include_once "php/getdata.php";
- ArchDemon 2:49 pm