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

PHP扩展开发(五)

WBOY
Release: 2016-06-13 12:29:00
Original
871 people have browsed it

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初始化一个空间,然后再释放。 

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template