我正在尝试使用Zend_Reflection来读取某些类的文档块:
这是我的代码
$r = new Zend_Reflection_Class($class);
$docblock = $r->getDocblock();
它适用于具有如下文档块的类:
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Barcode
* @subpackage Renderer
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Image.php 23775 2011-03-01 17:25:24Z ralph $
*/
/** @see Zend_Barcode_Renderer_RendererAbstract*/
require_once 'Zend/Barcode/Renderer/RendererAbstract.php';
/**
* Class for rendering the barcode as image
*
* @category Zend
* @package Zend_Barcode
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Barcode_Renderer_Image extends Zend_Barcode_Renderer_RendererAbstract
但对于以下类别,即条令2实体定义,它不起作用,
<?php
namespace DbEntitiesEntity;
/**
* Class for archived companies
*
* @category DbEntities
* @package Ycode_DbEntities
* @copyright Copyright (c) 2012
* @licence Porprietory Code
* @Table(name="Archiveddeal",
* indexes={
* @index(name="textualIdentifier_idx", columns={"textualIdentifier"}),
* @index(name="rank_idx", columns={"rank"}),
* @index(name="realunique_idx", columns={"realunique"}),
* @index(name="coordinations_idx", columns={"latitude","longitude"})
* })
* @Entity
* @HumanFriendlyName = "Archived Companies"
* @author Jim
*/
class Archivedcompany extends Application_Model_Archivedcompany{
它在我的代码的第2行抛出了以下错误:
No valid tag name found within provided docblock line
第一个文件的$class的值是"Zend_Barcode_Render_Image",对于第二个文件,我尝试了"DbEntities\Entity\Archivedcompany"one_answers"\DbEntities\Inventity\Archivedcompany",它们都返回了相同的错误。
我不确定是否是命名空间混淆了ZendReflection,当我使用PHP的Reflection时,一切似乎都能正常工作
$rc = new ReflectionClass($class);
$comments = $rc->getDocComment();
如有任何帮助,我们将不胜感激。
也有类似的问题。我猜你有Windows的行尾。尝试将换行符从Windows风格转换为Unix风格。