mac下zephir第一步,安装+hello zephir!

第一步 安装autoconf re2c automake libtool等依赖,如果没有安装git的记得先安装git

brew install autoconf
brew install automake
brew install libtool
brew install re2c

第二步,下载源代码安装

git clone http://github.com/phalcon/zephir

cd zephir

./install -c

第三步,测试zephir是否安装成功

zephir help

结果如下,则证明安装成功

第四步,创建zephir文件,并且写入一个class


zephir init test
cd test/test && vim Hello.zep

第五步写入hello的class类(切记namespace 是和你的文件名对应的)

namespace Test;

/**
 * This is a sample class
 */
class Hello
{
    /**
     * This is a sample method
     */
    public function say()
    {
        echo "Hello World!";
    }
}

第六步,到test目录下,编译文件

zephir bulid

 

第七步 把对应的test.so放在扩展内,即在PHP.ini里面加一句(最好加在最后)

[zephir test]
extension = test.so

 

第八步,在php文件中引入

$model = new Test\Hello();
$model->say();

 第九步,在WEB上运行

大功告成

 

posted on 2016-08-02 23:33  小葱杰杰  阅读(436)  评论(0编辑  收藏  举报

导航