我目前遇到问题,我的laravel站点正在返回错误。我使用下面的代码:Laravel 4/SimpleXML/PHP节点不再存在
@extends('base')
@section('title', 'Experience stages')
@stop
@section('main')
<div class="container">
<div class="doc-content-box">
<legend>Experience stages</legend>
<?php
$stagesdir = 'C:\Users\E1\Desktop\theforgottenserver-v0.2.15-win64console\Mystic Spirit\data\XML';
if(is_dir($stagesdir)) {
$list = simplexml_load_file($stagesdir.'\stages.xml');
?>
<table class="table table-striped">
<thead>
<tr>
<th>From Level</th>
<th>To Level</th>
<th>Experience multiplier</th>
</tr>
</thead>
<tbody>
<?php
foreach($list->children() as $stage) {
if ($stage['maxlevel'] == '') {
$stage['maxlevel'] = '*';
}
echo '
<tr>
<td>'.$stage['minlevel'].'</td>
<td>'.$stage['maxlevel'].'</td>
<td style="width: 30%">'.$stage['multiplier'].'x</td>
</tr>';
}
}
else{
echo '<div class="alert alert-danger"><span class="label label-important">Error parsing your Monsters XML file</span><br /><br /> Invalid path!</div> ';
}
?>
</tbody>
</table>
</div>
</div>
@stop
在这的foreach,我wan't使用$list->world->children()
但它不为我工作。当我尝试运行我的网页,我得到以下错误:
main(): Node no longer exists
而且,这里是我的XML文件:http://paste.laravel.com/Koh
我可以使用它,而不->world
但后来,因为你在我的XML文件中看到,它就像我的表格中的<td>
一样。
有人吗?请? :P –
错误发生在哪一行(数字或代码)? –