如何在命名空间中使用连字符? [英] How do I use hyphen in namespacing?

查看:95
本文介绍了如何在命名空间中使用连字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用https://packagist.org/packages/bitdevelopment/yii2-validators,这是Yii2中的字数验证,但是我得到了

I am using https://packagist.org/packages/bitdevelopment/yii2-validators , a word count validation in Yii2, but I am getting

>PHP Parse Error – yii\base\ErrorException
    syntax error, unexpected '-', expecting ',' or ';'
    \bitdevelopment\yii2-validators\WordValidator;

如何使用此yii2 validator吗?

推荐答案

您不能在名称空间中使用hypen(-).由于类命名约定不接受连字符,因此必须使用下划线.请参见此处.

You cannot use hypen(-) in namespace. As Class naming convention don't accept hypen, you have to use underscore. See the namespace convention here.

这篇关于如何在命名空间中使用连字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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