easychen / LazyPHP4

LazyPHP4 , an API first framework for php developer
313 stars 66 forks source link

我在使用的过程中发现用你给的demo正则总是不匹配 #10

Closed hangox closed 9 years ago

hangox commented 9 years ago

这是我的Contorller

class TestController{

    /**
     * 文档分段信息
     * @ApiDescription(section="User", description="查看用户详细信息")
     * @ApiLazyRoute(uri="/user(/@id:[0-9]+",method="GET")
     * @ApiParams(name="id", type="int", nullable=false, description="Uid", check="i|check_not_empty", cnname="用户ID")
     * @ApiReturn(type="object", sample="{'id':123}")
     */
    function info($id){
        if( !$user = db()->getData( "SELECT * FROM `user` WHERE `id` =:id LIMIT 1" , $id )->toLine() )
            throw new \Lazyphp\core\DataException("UID 对应的用户数据不存在");
        return send_result( $user );
    }
}

但是在lib/functions.php

function parse_comment( $comment )
{
    print_r($comment);
    $ret = false;

    $reg = '/@Api(.+?)\((.+?)\)$/im';
    if( preg_match_all($reg,$comment,$out) )
    {
        print(in);
        $ret = array() ; $i = 0 ;

        while( isset( $out[1][$i] ) )
        {
            $ret[$out[1][$i]][] = str2value( $out[2][$i] );

            $i++;

        }
    }
    var_dump($ret);
    return $ret;
}

这里总是无法验证通过,总是返回false,由于我不是很懂正则表达式,不能找出问题所在

hangox commented 9 years ago

对不起作者,我二了,没事了,虽然还是不能运行,但是发现不是这个问题

easychen commented 9 years ago

lp4我们还没释放公测版本,现在是给大家看结构和实现的,所以测试和文档都很欠缺。过段时间我们会更新的。

hangox commented 9 years ago

我昨天花了一天的时间大概搞懂了工作的流程,但是当我build的时候,总是报一个data[method] not defined,导致build rounte 失败 。在这里非常感谢你写的这个项目,让前端的工作者也能轻易的驾驭后台

On 2014年11月8日周六 上午9:26 Easy notifications@github.com wrote:

lp4我们还没释放公测版本,现在是给大家看结构和实现的,所以测试和文档都很欠缺。过段时间我们会更新的。

— Reply to this email directly or view it on GitHub https://github.com/geekcompany/LazyPHP4/issues/10#issuecomment-62239313.