宝哥软件园

用PHP编写UltraEdit插件脚本的实现方法

编辑:宝哥软件园 来源:互联网 时间:2021-10-11

要求:1。SVN本地有一套代码(编辑器UltraEdit),开发机上有一套代码(centos),需要在本地修改后上传到开发机上。2.不直接在开发机上修改使用,因为很多人用的是同一个开发机。为了保留本地备份的想法:1。编写一个作为UltraEdit插件的脚本。修改代码后,通过按配方按钮,可以直接将代码保存在本地并上传到centos。2本地是windows,远程是linux,文件上传工具可以使用pscp.exe,脚本语言使用PHP或Python 3,PHP必须安装在本地。不需要安装数据库,apache 4用PHP启动一个进程来调用pscp.exe。路径分析和其他逻辑放在php中。步骤:1设置脚本PHP ' c : users NickyJF desktop mesh tools sync file sync 142 . PHP ' %p%n%e以下% p % n % e是当前编辑文件的绝对路径,它作为参数传递到sync142.php中(。

2 sync142.php码复制码如下:Php //插件,将windwos文件同步到Linux//PHP ' rsync 142 . PHP ' % p % n % e//validargv//testcode/* $ argv=array(' rsync 142 . PHP ',' e: SVN test 。*/if(count($ argv)=2){ $ sFilePath=$ argv[1];$ SServername=' 192 . 168 . 10 . 142 ';$ sServerUserName=' name$ sServerPassword=' password$ sServerPath=sGetServerPath($ sFilePath);$ realPath=sprintf(%[email protected]% s :/% s ',$ sServerUserName,$ sserverspath);尝试{ $cmd=sprintf('pscp.exe -pw %s %s ',$ sServerPassword,$sFilePath,$ real path);回声$cmd。 n ';系统($ cmd);} catch(异常$ e){ print _ r($ e);退出;} }函数sGetServerPath($ sWindowsPath){ $ ret=' ';$ path=explode(' ',$ sWindowsPath);if($startKey=array_search('www ',$ path)){ $ ret=' test/';for($ I=$ StartKey 1;$ I count($ path);$i ) { $ret。=$ path[$ I],”/';} $ret=trim($ret,'/');}返回$ ret} ?3将pscp.exe放入sync142目录image

将Ctrl 1键映射到该脚本,这样您就可以在编写程序时按Ctrl 1,用远程脚本替换当前脚本。

更多资讯
游戏推荐
更多+