Home >Backend Development >PHP Tutorial >PHP扩展开发(五)

PHP扩展开发(五)

WBOY
WBOYOriginal
2016-06-13 12:29:00871browse

PHP扩展开发(5)

1. 定义

 

//定义PHP常量
REGISTER_STRINGL_CONSTANT("SIMPLE_VERSION", PHP_SIMPLE_VERSION, sizeof(PHP_SIMPLE_VERSION) - 1, CONST_PERSISTENT | CONST_CS);

 

 

2. 读取

 

zval *app_path;
MAKE_STD_ZVAL(app_path);
zend_get_constant("APP_PATH", strlen("APP_PATH"), app_path TSRMLS_CC);
RETURN_STRINGL(Z_STRVAL_P(app_path), Z_STRLEN_P(app_path), 1);
efree(app_path);

 

要先给app_path初始化一个空间,然后再释放。 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:其他的一些小技巧Next article:php学习一环境搭建