-
大小: 1.77MB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2023-11-07
- 語(yǔ)言: C/C++
- 標(biāo)簽: php-cpp??c++??php7??擴(kuò)展開發(fā)??
資源簡(jiǎn)介
linux下的php-cpp項(xiàng)目,這個(gè)項(xiàng)目生成動(dòng)態(tài)鏈接庫(kù),使用這個(gè)動(dòng)態(tài)鏈接庫(kù),可以快速地用C++開發(fā)php擴(kuò)展。相比較php官方提供的,用c語(yǔ)言開發(fā)php擴(kuò)展方案。php-cpp使得開發(fā)php擴(kuò)展更加簡(jiǎn)單快捷。php-cpp官方目前只支持在類unix平臺(tái)編譯安裝。還不支持在windows平臺(tái)上的編譯。本項(xiàng)目實(shí)現(xiàn)了將php-cpp項(xiàng)目完整地移植到windows平臺(tái)

代碼片段和文件信息
#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
//原項(xiàng)目中的add方法在重載時(shí)有點(diǎn)問(wèn)題,現(xiàn)在將添加函數(shù)到擴(kuò)展的功能重命名為?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;
????}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-08-02?20:00??php-cpp項(xiàng)目移值到windows的vs2017解決方案\
?????目錄???????????0??2019-08-02?13:36??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\
?????文件?????????373??2019-08-02?11:41??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\install_ext.php
?????文件????????2544??2019-08-02?13:34??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\main.cpp
?????文件?????????896??2019-07-30?20:45??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\myPhpcppExt.sln
?????文件????????4273??2019-08-02?12:29??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\myPhpcppExt.vcxproj
?????文件?????????165??2019-07-30?20:35??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\myPhpcppExt.vcxproj.user
?????目錄???????????0??2019-08-02?12:07??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\
?????目錄???????????0??2019-08-02?13:33??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\
?????文件????????4405??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\argument.h
?????文件????????3029??2019-07-29?21:10??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\array.h
?????文件????????1100??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\arrayaccess.h
?????文件????????6746??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\ba
?????文件????????1347??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\byref.h
?????文件????????1345??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\byval.h
?????文件????????7699??2019-07-28?19:29??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\call.h
?????文件???????32464??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\class.h
?????文件???????12114??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\classba
?????文件?????????816??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\classtype.h
?????文件????????4029??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\constant.h
?????文件?????????682??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\countable.h
?????文件?????????566??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\deprecated.h
?????文件????????1370??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\error.h
?????文件????????1239??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\exception.h
?????文件????????6219??2019-08-02?11:35??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\extension.h
?????文件????????2110??2019-07-29?21:06??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\file.h
?????文件????????2011??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\function.h
?????文件????????3851??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\global.h
?????文件????????1354??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\globals.h
?????文件???????21440??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\hashmember.h
?????文件????????2829??2019-04-05?18:43??php-cpp項(xiàng)目移值到windows的vs2017解決方案\myPhpcppExt1\phpcpp-dev\include\hashparent.h
............此處省略585個(gè)文件信息
評(píng)論
共有 條評(píng)論