命名空间接口 [英] Namespace interface

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

问题描述

我有结构:

/VBAL/
/VBAL/Interface/
/VBAL/Interface/Named.php
....
/VBAL/Component.php

Component.php:

Component.php:

namespace JV\VBAL; 
class Component implements \JV\VBAL\Interface\Named {}

Named.php:

Named.php:

namespace JV\VBAL\Interface;
interface Named {}

但是我有解析错误:

解析错误:语法错误,意外的"{",预期为T_STRING或 T_NAMESPACE或T_NS_SEPARATOR

Parse error: syntax error, unexpected '{', expecting T_STRING or T_NAMESPACE or T_NS_SEPARATOR

如何命名目录命名空间"或放置文件?

How do you call the directory "namespace", or place the files?

推荐答案

Interface是PHP中的保留字.您不能将其用作名称空间的一部分.

Interface is a reserved word in PHP. You can't use it as part of your namespace.

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

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