使用PHP-CPP处理PHP的小扩展,我在C++端接收一个带有对象的数组,我需要检索它的类名.对象Php :: Value看起来没有任何方法.
与我在此扩展中的HNI类似:https: //github.com/mcuadros/bson-hni/blob/master/src/encode.cpp#L86
我正在尝试在centos 6,5上安装php-cpp.当我运行命令make时,我收到错误:
make: Warning: File `Makefile' has modification time 5.1e+05 s in the future
mkdir -p shared/common
mkdir -p shared/zend
mkdir -p shared/hhvm
g++ -Wall -c -g -std=c++11 -fpic -o shared/common/modifiers.o common/modifiers.cpp
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [shared/common/modifiers.o] Error 1
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能解决这个问题?我的g ++是:
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS …Run Code Online (Sandbox Code Playgroud) 我正在使用PHP-CPP库来开发 PHP 扩展。
当我在 C++ 中尝试以下操作时:
#include <phpcpp.h>
static int number=0;
Php::Value get_num()
{
number++;
return number;
}
Run Code Online (Sandbox Code Playgroud)
PHP 中的以下内容:
<?php
echo get_num();
?>
Run Code Online (Sandbox Code Playgroud)
一切都按预期工作一段时间,但随后“number”变量随机重置为零。另外,在 Firefox 中按 CTRL+F5,“number”变量会再次重置为零。
如何避免“数字”被重置?