【发布时间】:2017-05-30 16:46:48
【问题描述】:
我有这个代码:
menu.php
<?php
$menu = [
[
"id"->"home",
"name"->"Home page",
"url"->"/index.php"
]
}; ?>
index.php
<?php
require 'menu.php';
$menubar = [
"menu" -> $menu,
"current" -> "home" // this line
]; ?>
<!-- and some html -->
当然,它不起作用。
解析错误:
语法错误,意外的 '"home"' (T_CONSTANT_ENCAPSED_STRING),在第 11 行的 D:\xampp\htdocs\index.php 中需要标识符 (T_STRING) 或变量 (T_VARIABLE) 或 '{' 或 '$'`
如何修复?
【问题讨论】:
标签: php associative-array