一个名为default的php名称空间 [英] A php namespace called default

查看:65
本文介绍了一个名为default的php名称空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?php
namespace default

给了我一个意外的T_DEFAULT,有什么办法可以解决这个问题?我能以某种方式逃脱保留字吗?

gives me an unexpecected T_DEFAULT, is there any way of working around this? Can I escape the reserved word somehow?

我的系统使用我站点中当前模块的名称作为名称空间,因此能够将任何字符串用作名称空间都很好.

My system uses the name of the current module in my site for the namespace so it would be nice to be able to use any string as a namespace.

推荐答案

您不能在PHP的命名空间中使用诸如default之类的保留字-您必须找到一种解决方法(_defaultdefault_default1等?).

You can't use reserved words like default for namespaces in PHP - you'll have to find a workaround (_default, default_, default1 etc.?).

这篇关于一个名为default的php名称空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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