您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP怎么调用其它语言程序

2024/3/4 3:21:38发布21次查看
php如何调用其它语言程序
php具体提供了两个函数:1 system() 2.是exec 通过这样调用我们可以实现php很多所不能实现的功能 这里我用c++来测试下 怎样用php调用c++的exe程序获取当前系统的进程情况!。(来源:移动应用商城(cmccapp.com))
1.vc建立w32控制台程序 code:
#include
#include windows.h
#include tlhelp32.h
#include stdio.h
using namespace std;
int main(int argc, char* argv[])
{
? processentry32 pe32;
? pe32.dwsize = sizeof(pe32);
? handle hprocesssnap = ::createtoolhelp32snapshot(th32cs_snapprocess,0);
? if(hprocesssnap==invalid_handle_value)
? {
? ? cout? ? return -1;
? }
? bool bmore = ::process32first(hprocesssnap,&pe32);
? while(bmore)
? {
? ? printf(进程名称: %s\n,pe32.szexefile);
? ? printf(进程id %u\n\n
,pe32.th32processid);
? ? bmore = ::process32next(hprocesssnap,&pe32);
? }
? ::closehandle(hprocesssnap);
? return 0;
}
编译成exe!
接着php写入 code:
将路径换成你的路径 试试效果 来张截图吧!
此文章来自移动应用商城(cmccapp.com)? 转载请著名出处!
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product