資源簡介
linux下的php-cpp項目,這個項目生成動態鏈接庫,使用這個動態鏈接庫,可以快速地用C++開發php擴展。相比較php官方提供的,用c語言開發php擴展方案。php-cpp使得開發php擴展更加簡單快捷。php-cpp官方目前只支持在類unix平臺編譯安裝。還不支持在windows平臺上的編譯。本項目實現了將php-cpp項目完整地移植到windows平臺

代碼片段和文件信息
#include?“phpcpp.h“
Php::Value?my_plus(Php::Parameters?¶ms)
{
return?params[0]?+?params[1]?;
}
void?my_example()
{
//?the?C++?equivalent?of?the?echo()?function
Php::out?<“example?1“?<
//?generate?output?without?a?newline?and?ensure?that?it?is?flushed
Php::out?<“example?2\n“?<
//?or?call?the?flush()?method
Php::out?<“example?3\n“;
Php::out.flush();
//?just?like?all?PHP?functions?you?can?call?the?echo()?function?
//?from?C++?code?as?well
Php::echo(“Example?4\n“);
Php::out.flush();
}
void??my_echo()
{
//?the?C++?equivalent?of?the?echo()?function
Php::out?<“my_echo?test6“?< Php::out.flush();
}
Php::Value?native_bubblesort(Php::Parameters?¶ms)
{
//?there?is?one?input?array?cast?the?PHP?variable?to?a?vector?of?ints
std::vector?input?=?params[0];
//?loop?through?the?array
for?(size_t?i?=?0;?i? {
//?loop?through?the?elements?that?were?already?processed
for?(size_t?j?=?1;?j? {
//?move?on?if?smaller
if?(input[j?-?1]?<=?input[j])?continue;
//?swap?elements
int?temp?=?input[j];
input[j]?=?input[j?-?1];
input[j?-?1]?=?temp;
}
}
//?done
return?input;
}
/**
?*??tell?the?compiler?that?the?get_module?is?a?pure?C?function
?*/
extern?“C“?{
????
????/**
?????*??Function?that?is?called?by?PHP?right?after?the?PHP?process
?????*??has?started?and?that?returns?an?address?of?an?internal?PHP
?????*??strucure?with?all?the?details?and?features?of?your?extension
?????*
?????*??@return?void*???a?pointer?to?an?address?that?is?understood?by?PHP
?????*/
????__declspec(dllexport)?void?*get_module()
????{
????????//?static(!)?Php::Extension?object?that?should?stay?in?memory
????????//?for?the?entire?duration?of?the?process?(that‘s?why?it‘s?static)
????????static?Php::Extension?extension(“myPhpcppExt1“?“1.0“);
????????
????????//?@todo????add?your?own?functions?classes?namespaces?to?the?extension
//原項目中的add方法在重載時有點問題,現在將添加函數到擴展的功能重命名為?addFunc
extension.add(“my_plus“?{
Php::ByVal(“a“?Php::Type::Numeric)
Php::ByVal(“b“?Php::Type::Numeric)
});
extension.add(“my_example“);
extension.add(“my_echo“);
extension.add(“native_bubblesort“{ Php::ByVal(“input“?Php::Type::Array) });
????????
????????//?return?the?extension
????????return?extension;
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-08-02?20:00??php-cpp項目移值到windows的vs2017解決方案\
?????目錄???????????0??2019-08-02?13:36??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\
?????文件?????????373??2019-08-02?11:41??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\install_ext.php
?????文件????????2544??2019-08-02?13:34??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\main.cpp
?????文件?????????896??2019-07-30?20:45??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\myPhpcppExt.sln
?????文件????????4273??2019-08-02?12:29??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\myPhpcppExt.vcxproj
?????文件?????????165??2019-07-30?20:35??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\myPhpcppExt.vcxproj.user
?????目錄???????????0??2019-08-02?12:07??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\
?????目錄???????????0??2019-08-02?13:33??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\
?????文件????????4405??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\argument.h
?????文件????????3029??2019-07-29?21:10??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\array.h
?????文件????????1100??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\arrayaccess.h
?????文件????????6746??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\ba
?????文件????????1347??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\byref.h
?????文件????????1345??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\byval.h
?????文件????????7699??2019-07-28?19:29??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\call.h
?????文件???????32464??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\class.h
?????文件???????12114??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\classba
?????文件?????????816??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\classtype.h
?????文件????????4029??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\constant.h
?????文件?????????682??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\countable.h
?????文件?????????566??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\deprecated.h
?????文件????????1370??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\error.h
?????文件????????1239??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\exception.h
?????文件????????6219??2019-08-02?11:35??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\extension.h
?????文件????????2110??2019-07-29?21:06??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\file.h
?????文件????????2011??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\function.h
?????文件????????3851??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\global.h
?????文件????????1354??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\globals.h
?????文件???????21440??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\hashmember.h
?????文件????????2829??2019-04-05?18:43??php-cpp項目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\hashparent.h
............此處省略585個文件信息
- 上一篇:CA認證系統
- 下一篇:VC讀取shapefile文件源碼,處理點線面
評論
共有 條評論