php网站封装apk源码分享(php封包)

大家好,关于php网站封装apk源码分享很多朋友都还不太明白,不过没关系,因为今天小编就来为大家分享关于php封包的知识点,相信应该可以解决大家的一些困惑和问题,如果碰巧可以解决您的问题,还望关注下本站哦,希望对各位有所帮助!

PHP解析MysqlBinlog,依赖于mysql-replication-listener库

详见:https://github.com/bullsoft/php-binlog

InstallMySQLReplicationListener

https://github.com/bullsoft/mysql-replication-listener/archive/master.zip

该源码,有一处bug,在tcp_driver.cpp第650行处:

intBinlog_tcp_driver::set_position(conststd::string&str,unsignedlongposition)

{

/*

Validatethenewpositionbeforeweattempttoset.Oncewesetthe

positionwewon’tknowifitsuccededbecausethebinlogdumpis

runninginanotherthreadasynchronously.

*/

/*

//这个地方会导致,如果set_position不是最后一个binlogfile,而且position又大于最后一个binlogsize,则会返回失败,特此屏蔽掉该判断

if(position>=m_binlog_offset){

returnERR_FAIL;

}

*/

修改后的mysql-replication-listener源码和php-binlog源码打包下载地址:

http://download.csdn.net/download/xtjsxtj/9843275

unzipmysql-replication-listener-master.zip

cdmysql-replication-listener-master

cmake.-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-replication

make&makeinstall

Installphp-binlog

https://github.com/bullsoft/php-binlog/archive/master.zip

unzipphp-binlog-master.zip

cdphp-binlog-master/ext

/usr/local/php5.5.15/bin/phpize

./configure–with-php-config=/usr/local/php5.5.15/bin/php-config–with-mysql-binlog=/usr/local/mysql-replication

Examples

注:Binlog为行格式

<?php

$link=binlog_connect(“mysql://root:cpyf@127.0.0.1:3306”);

//binlog_set_position($link,4);

//binlog_set_position($link,4,’mysql-bin.000006′);

while($event=binlog_wait_for_next_event($link)){

//itwillblockhere

switch($event[‘type_code’]){

caseBINLOG_DELETE_ROWS_EVENT:

var_dump($event);

//dowhatuwant…

break;

caseBINLOG_WRITE_ROWS_EVENT:

var_dump($event);

//dowhatuwant…

break;

caseBINLOG_UPDATE_ROWS_EVENT:

var_dump($event);

//dowhatuwant…

break;

default:

//var_dump($event);

break;

}

}

Update_rows

update`type`settype_id=22WHEREidin(58,59);

array(5){

‘type_code’=>

int(24)

‘type_str’=>

string(11)”Update_rows”

‘db_name’=>

string(5)”cloud”

‘table_name’=>

string(4)”type”

‘rows’=>

array(4){

[0]=>

array(5){

[0]=>

string(2)”58″

[1]=>

string(8)”adsfasdf”

[2]=>

string(4)”asdf”

[3]=>

string(2)”22″

[4]=>

string(1)”0″

}

[1]=>

array(5){

[0]=>

string(2)”58″

[1]=>

string(8)”adsfasdf”

[2]=>

string(4)”asdf”

[3]=>

string(1)”4″

[4]=>

string(1)”0″

}

[2]=>

array(5){

[0]=>

string(2)”59″

[1]=>

string(8)”adsfasdf”

[2]=>

string(4)”asdf”

[3]=>

string(2)”22″

[4]=>

string(1)”0″

}

[3]=>

array(5){

[0]=>

string(2)”59″

[1]=>

string(8)”adsfasdf”

[2]=>

string(4)”asdf”

[3]=>

string(1)”4″

[4]=>

string(1)”0″

}

}

}

Delete_rows

deletefrom`type`WHEREidin(58,59);

array(5){

‘type_code’=>

int(25)

‘type_str’=>

string(11)”Delete_rows”

‘db_name’=>

string(5)”cloud”

‘table_name’=>

string(4)”type”

‘rows’=>

array(2){

[0]=>

array(5){

[0]=>

string(2)”58″

[1]=>

string(8)”adsfasdf”

[2]=>

string(4)”asdf”

[3]=>

string(2)”22″

[4]=>

string(1)”0″

}

[1]=>

array(5){

[0]=>

string(2)”59″

[1]=>

string(8)”adsfasdf”

[2]=>

string(4)”asdf”

[3]=>

string(2)”22″

[4]=>

string(1)”0″

}

}

}

Write_rows

insertintotypevalues(Null,”Hello,World”,”Bestworld”,4,0),(NULL,”你好,世界”,”世界很美好”,3,5);

array(5){

‘type_code’=>

int(23)

‘type_str’=>

string(10)”Write_rows”

‘db_name’=>

string(5)”cloud”

‘table_name’=>

string(4)”type”

‘rows’=>

array(2){

[0]=>

array(5){

[0]=>

string(2)”95″

[1]=>

string(12)”Hello,World”

[2]=>

string(10)”Bestworld”

[3]=>

string(1)”4″

[4]=>

string(1)”0″

}

[1]=>

array(5){

[0]=>

string(2)”96″

[1]=>

string(15)”你好,世界”

[2]=>

string(15)”世界很美好”

[3]=>

string(1)”3″

[4]=>

string(1)”5″

}

}

}

php网站封装apk源码分享和php封包的问题分享结束啦,以上的文章解决了您的问题吗?欢迎您下次再来哦!

Published by

风君子

独自遨游何稽首 揭天掀地慰生平