简体   繁体   English

从C程序调用PHP

[英]Calling PHP from C program

I have a php function that I want to run from a C program. 我有一个想从C程序运行的php函数。 The file is '/path/auth.php' and the function is authenticate($user, $pwd). 文件为“ /path/auth.php”,函数为authenticate($ user,$ pwd)。 The function will echo either a 1 or 0 if a user has authenticated properly. 如果用户已正确验证,该函数将回显1或0。 I need to get this result back into the C program and then run other code based on the results. 我需要将此结果返回到C程序,然后根据结果运行其他代码。 How should I go about it? 我应该怎么做?

  1. Add PHP to your environment variable PATH PHP添加到环境变量PATH

  2. The command to execute your script is php path/auth.php 执行脚本的命令是php path/auth.php

  3. Follow this link to write your c code 点击此链接编写您的C代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM