为什么找不到IntlDateFormatter


Why is IntlDateFormatter not found?

php intl扩展插件已加载因为我可以在视图脚本中毫无问题地使用IntlDateFormatter::SHORT。

我的ViewHelper 中的位

<?php
namespace Common'View'Helper;
use Zend'View'Helper'AbstractHelper;
class DateFormat extends AbstractHelper {
    public function __invoke($dateField) {
        $dateFormatter=$this->getView()->plugin('dateformat');        
        return $dateFormatter(strtotime($dateField),       IntlDateFormatter::SHORT);  
    }
}
?>

我得到错误

致命错误:在中找不到类"Common''View''Helper''IntlDateFormatter"C: ''TEMP''zf2ad''client''module''Common''src''Common''View''Helper''DateFormat.php在线12

请告知

Ephraim

由于您在命名空间上下文中工作,它会在实际的命名空间Common'View'Helper中查找类。如果类在全局命名空间中,则必须在类前面添加一个反斜杠。

return $dateFormatter(strtotime($dateField), 'IntlDateFormatter::SHORT);
相关文章:
  • 没有找到相关文章