小编Nik*_*los的帖子

我该如何安装Phalcon Devtools

对于Phalcon的0.5.0版本,如何安装phalcon-devtools以便我可以通过命令shell使用它们?

php phalcon

5
推荐指数
1
解决办法
3893
查看次数

已安装Thrift,但是在尝试运行Thrift命令时显示Thrift:找不到命令

我已经在Mac中安装了Thrift。

从终端看来,thrift已成功安装,但是当我尝试运行thrift命令时,得到以下信息

Thrift: command not found
Run Code Online (Sandbox Code Playgroud)

我从终端使用了whereis命令来找到节俭的位置,但找不到它。

有什么建议么?

安装节俭节俭0.9.0后的终端输出

Building C++ Library ......... : yes
Building C (GLib) Library .... : no
Building Java Library ........ : yes
Building C# Library .......... : no
Building Python Library ...... : yes
Building Ruby Library ........ : yes
Building Haskell Library ..... : no
Building Perl Library ........ : yes
Building PHP Library ......... : yes
Building Erlang Library ...... : no
Building Go Library .......... : no
Building D Library ........... …
Run Code Online (Sandbox Code Playgroud)

macos installation thrift

5
推荐指数
1
解决办法
4537
查看次数

文本文件中的增量编号

我想在文本文件中记录下载

有人来到我的网站并下载了一些东西,它会在文本文件中添加一个新行(如果尚未增加或增加当前文件).

我试过了

$filename = 'a.txt';
$lines    = file($filename);
$linea    = array();

foreach ($lines as $line) 
{ 
    $linea[] = explode("|",$line);
}

$linea[0][1] ++;

$a = $linea[0][0] . "|" . $linea[0][1];

file_put_contents($filename, $a);
Run Code Online (Sandbox Code Playgroud)

但它总是增加1以上

文本文件格式是

 name|download_count
Run Code Online (Sandbox Code Playgroud)

php

5
推荐指数
1
解决办法
1265
查看次数

Phalcon\Mvc\Model :: beforeCreate()方法

如果我尝试使用beforeCreate()方法中定义的date_created字段保存模型,则不会保存它:

class TestEntity extends Phalcon\Mvc\Model
{

    public function beforeCreate()
    {
        $this->date_created = date('Y-m-d H:i:s');
    }

    /**
     * Returns source table name
     * @return string
     */
    public function getSource()
    {
        return 'test_entity';
    }
}
Run Code Online (Sandbox Code Playgroud)

控制器动作上下文

$test = new TestEntity();
$test->name = 'test';
var_dump($contact->save()); // gives false
var_dump($contact->getMessages()); // says date_created is not defined
Run Code Online (Sandbox Code Playgroud)

php phalcon

3
推荐指数
1
解决办法
3578
查看次数

正则表达式在.NET中找到令牌值

我需要一些在Regex上比我更好的人的帮助:)

我试图使用.NET(C#)在字符串中查找特定标记的值

我拥有的字符串有这样的标记 {token:one}

我的功能如下:

public static ArrayList GetMatches(string szInput)
{
    // Example string
    // Lorem ipsum {token:me} lala this {token:other} other stuff
    ArrayList aResults = new ArrayList();
    string szPattern = @"(\{token:(*)\})";

    foreach (Match match in Regex.Matches(szInput, szPattern))
    {
        aResults.Add(match.Value);
    }
    // It should contain me and other
    return aResults;
}
Run Code Online (Sandbox Code Playgroud)

任何指针都不仅仅是值得赞赏的.

.net c# regex

3
推荐指数
1
解决办法
2284
查看次数

Phalcon\Tag :: linkTo URL不包含项目所在的子文件夹

我正在使用PHP 5.3,phalcon 0.5.0跟踪OS X 10.8上的教程.我有一个tutorial在我的apache的web根目录中调用的文件夹.当我使用代码时:

echo Phalcon\Tag::linkTo("signup", "Sign Up Here!");
Run Code Online (Sandbox Code Playgroud)

在输出html我得到

localhost/signup 
Run Code Online (Sandbox Code Playgroud)

代替

localhost/tutorial/signup
Run Code Online (Sandbox Code Playgroud)

我还在我的.htacess文件中输入了RewriteBase/tutorial /,但仍然遇到同样的问题.我在0.4的phalcon和0.5中都有同样的问题

php rewrite phalcon

1
推荐指数
1
解决办法
2014
查看次数

如何在phalcon框架中应用路由器/ roite?

这里,在docs中,写了关于如何创建路由的文章:http: //docs.phalconphp.com/en/latest/reference/routing.html

但我无法找到我如何在应用程序中注入它们.我需要做什么,让我的应用程序使用定义的路由?

我应该注入路由器(或如何?)

php routing phalcon

0
推荐指数
1
解决办法
5752
查看次数

是否可以在一个Phalcon\Mvc\Model :: find()方法中指定两个限制值(from,offset)?

我找到了以下示例:

 $robots = Robots::find(array("limit" => 100));
Run Code Online (Sandbox Code Playgroud)

是否可以为限制"从"和"偏移"定义两个值?在Zend Framework中,有可能使用Db适配器功能,如下所示:

 $db->select()->limit($from, $offset)
Run Code Online (Sandbox Code Playgroud)

php phalcon

0
推荐指数
1
解决办法
2801
查看次数

在UIScrollview中拖动会增加其子视图计数

我是iOS的初学者.我创建了一个UIScrollview带有5个图像并根据方向设置其宽度,高度和大小的变化.添加所有5个图像后,滚动视图子视图计数为5.但是当开始拖动时,计数增加到7.我不知道添加空白视图的位置.


-(void)addImageWithName:(NSString*)imageString atPosition:(int)position {

    UIImage *image = [UIImage imageWithContentsOfFile:imageString];
    imageView = [[UIImageView alloc] initWithImage:image];
    // imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    imageView.frame = CGRectMake(position*scrollview.frame.size.width*2, 0, scrollview.frame.size.width *2,scrollview.frame.size.height );
    imageView.tag = 1000 + position +1;

    [scrollview addSubview:imageView];
}

-(void)imageLoad:(NSInteger)startImage
{

    int Index = -1;
    for (UIImageView *subview in scrollview.subviews)
    {

        [subview removeFromSuperview];
    }


    for (int i = startImage; i < startImage+5; i++) {

        Index++;


        fullPath = [dataPath stringByAppendingString:[NSString stringWithFormat:@"/image%d.jpg",i]];


        [self addImageWithName:fullPath atPosition:Index];
        scrollview.contentSize = CGSizeMake(i*scrollview.frame.size.width, 0);

    }

}
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios ios6

0
推荐指数
1
解决办法
286
查看次数

标签 统计

php ×6

phalcon ×5

.net ×1

c# ×1

installation ×1

ios ×1

ios6 ×1

iphone ×1

macos ×1

objective-c ×1

regex ×1

rewrite ×1

routing ×1

thrift ×1