gpt4 book ai didi

php - 如何访问php扩展中的当前php文件(用c编写)?

转载 作者:可可西里 更新时间:2023-10-31 23:40:38 25 4
gpt4 key购买 nike

我正在尝试使用 swig 为 php 编写扩展。我需要知道我的扩展代码中当前 php 文件的绝对路径。我在我的 C 代码中使用了 __ FILE __ 但它返回当前的 c 文件名。

最佳答案

我终于找到了解决办法。要在你的 php 扩展中访问 __ FILE __,你可以这样使用:

char *file_name = zend_get_executed_filename();

关于php - 如何访问php扩展中的当前php文件(用c编写)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23042768/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com