php7-internal icon indicating copy to clipboard operation
php7-internal copied to clipboard

请问下php7的扩展里怎么改写引用的值

Open wuzhix opened this issue 8 years ago • 2 comments

zval *a; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &a) == FAILURE) { RETURN_NULL(); } ZVAL_LONG(&(a->value.ref->val),110) 这样可以改写引用的值,但是感觉不太雅观,有没有内核api呢

wuzhix avatar Oct 19 '16 03:10 wuzhix

Z_REFVAL_P

chenxiaofa avatar Oct 19 '16 03:10 chenxiaofa

改成ZVAL_STRING(Z_REFVAL_P(a),"modify param");后得到了相同结果,给你点个赞 @chenxiaofa

wuzhix avatar Oct 19 '16 06:10 wuzhix