请问下php7的扩展里怎么改写引用的值
Opened this issue · 2 comments
wuzhix commented
zval *a;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a) == FAILURE)
{
RETURN_NULL();
}
ZVAL_LONG(&(a->value.ref->val),110)
这样可以改写引用的值,但是感觉不太雅观,有没有内核api呢
chenxiaofa commented
Z_REFVAL_P
wuzhix commented
改成ZVAL_STRING(Z_REFVAL_P(a),"modify param");后得到了相同结果,给你点个赞 @chenxiaofa