第一步 安装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

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

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

第四步,创建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

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

 

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

[zephir test]
extension = test.so

 

第八步,在php文件中引入

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

 第九步,在WEB上运行

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

大功告成

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2021-07-02
  • 2022-02-05
  • 2022-01-08
  • 2021-10-13
  • 2021-06-27
猜你喜欢
  • 2021-10-02
  • 2022-12-23
  • 2021-06-25
  • 2022-01-18
  • 2022-01-31
  • 2021-08-25
相关资源
相似解决方案