a.php只实现了那段代码:
<?php
$array[1][0] = array("gutes"=>"something_1");
$array[2][0] = array("gutes"=>"something_2");
$array[3][0] = array("gutes"=>"etc.");
$array[4][0] = array("gutes"=>"etc.2");
//..
//many many more.
?>
b.php包含:
<?php
//tried calls
//include("../path/a.php"); -> err 500
//@require_once("a.php"); -> err 500
//require("fehleranalyse_array_lebenslauf2.php"); ->err 500
//require_once("fehleranalyse_array_lebenslauf2.php");
//strange, i did not get an err 500, but also not the right output
//i see Test: but not Test: something_1
//include a.php;
//just for own tests: without including paths and only with that it works well
//$array[1][0] = array("gutes"=>"something_1");
$testname_array = "gutes";
echo "Test: " . $array[1][0][$testname_array] . "<br>";
?>
sry,但我看不到我的失败! ty
答案 0 :(得分:0)
你好@ein_noch_mieser_progger
我已经测试了以下方法,并且所有方法都成功运行:
使用include()
<?php
include('a.php');
$testname_array = "gutes";
echo "Test: " . $array[1][0][$testname_array] . "<br>";
?>
使用require()
<?php
require('a.php');
$testname_array = "gutes";
echo "Test: " . $array[1][0][$testname_array] . "<br>";
?>
使用require_once()
<?php
require_once('a.php');
$testname_array = "gutes";
echo "Test: " . $array[1][0][$testname_array] . "<br>";
?>
我希望能帮到你。
问候。