Why this do not work and how can I solve it please ?
Main page:
$a = include 'module_a.php';
print_r($a);
module_a.php page:
function go() {
include 'datas.php';
return $array;
}
datas.php page:
$array = array();
$array[10] = 'bla';
$array[11] = 'blo';
return $array;
I do not have any error in the console except that no code is print.
Thanks for your help.
I suppose it should be somehow like this:
include 'module_a.php';
$a = go();
print_r($a);
To your post update: datas.php doesn't have to return $array
Nothing is printed because you define function go
but you never execute it. Do:
include 'module_a.php';
print_r(go());
You forgot to call go
function
index.php
<?php
$a = include 'module_a.php';
print_r($a);
module_a.php
function go() {
include 'datas.php';
return $array;
}
return go();
datas.php
<?php
$array = array();
$array[10] = 'bla';
$array[11] = 'blo';
return $array;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.