解析错误:语法错误,意外的'对象'(T_STRING),期待')' [英] Parse error: syntax error, unexpected 'object' (T_STRING), expecting ')'

查看:336
本文介绍了解析错误:语法错误,意外的'对象'(T_STRING),期待')'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数组我想要包含对象,但它一直返回

I have an array I want to contain objects but it keeps returning

Parse error: syntax error, unexpected 'Object' (T_STRING), expecting ')' 



仔细看看导致此类错误的原因会发现,当字符串没有用引号括起来时会发生这种情况,但我似乎无法破译我没有包装的字符串。我的代码发布在下面


A closer look at what causes such errors reveals it occurs when strings are not wrapped in quotes but I can't seem to decipher what string I'm not wrapping. My code is posted below

$all_users = Array
(
    [user_name] => Admin Object
        (
            [can_comment] => 1
            [can_view_announcements] => 1
            [profile_pic] => "/dir/accounts/assets.png"
            [can_delete_comment] => 1
        )
)





我尝试过:



创建此代码的代码是
$ all_users = array();

$ user_name =新成员(user_name);

$ all_users ['user_name'] = $ user_name;



请问有什么问题?



What I have tried:

The code that creates this is
$all_users = array();
$user_name = new Member("user_name");
$all_users['user_name'] = $user_name;

Please what is wrong with it?

推荐答案

all_users =数组

[user_name] =>管理对象

[can_comment] => 1
[can_view_announcements] => 1
[profile_pic] => / dir / accounts / assets.png
[can_delete_comment] => 1

all_users = Array ( [user_name] => Admin Object ( [can_comment] => 1 [can_view_announcements] => 1 [profile_pic] => "/dir/accounts/assets.png" [can_delete_comment] => 1 ) )





我尝试了什么:



创建它的代码是



What I have tried:

The code that creates this is


all_users = array ();
all_users = array();


user_name =新成员(user_name);
user_name = new Member("user_name");


这篇关于解析错误:语法错误,意外的'对象'(T_STRING),期待')'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆