加载了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);
}
}
?>我知道错误了
致命错误:在第12行的C:\TEMP\zf2ad\client\module\Common\src\Common\View\Helper\DateFormat.php中找不到“公共\视图\Helper\IntlDateFor事宜”类
请指教
以法莲
发布于 2015-04-09 15:09:51
因为您在命名空间上下文中工作,所以它在实际的命名空间Common\View\Helper中查找类。如果类位于全局命名空间中,则必须在类前面添加反斜杠。
return $dateFormatter(strtotime($dateField), \IntlDateFormatter::SHORT);https://stackoverflow.com/questions/29542011
复制相似问题