我正在用C语言创建一个简单的php服务器,并尝试执行php脚本。我可以通过调用: execl("/usr/bin/php","/usr/bin/php","-q",phpFile,(char *) NULL);
然而,我在向这个文件发送get参数时遇到了问题。例如:./index.php?name=test我该怎么做?
发布于 2014-11-02 20:13:07
你不能把参数附加到php文件的末尾吗?我认为这样的东西应该是可行的:
char phpFile [128] = "./index.php";
char * args = "name=test";
char * args2 = "city=paris";
strcat(phpFile, "?");
strcat(phpFile, args);
strcat(phpFile, "&");
strcat(phpFile, args2); // etc. if you want to add more args.https://stackoverflow.com/questions/26699023
复制相似问题