<?php class WeChatMenu{ private $AppId = ""; //公共平台提供的AppId private $AppSecret = ""; //公共平台提供的AppSecret public $AccessToken = ""; //公共平台提供的AccessToken private $platform = "weixin"; //平台类型。如果是易信,则为 "weixin"; 如果是易信,则为 "yixin" public $host = "api.weixin.qq.com"; ///平台服务器. 微信为api.weixin.qq.com, 易信为api.yixin.im public $errcode = 0; //错误代码 public $errmsg = ""; //错误信息文本这是一个菜单类库1、增加单个一级菜单 addSingleMenu($name,$type,$value) 2、增加子集菜单类型 addMenuItem($name,$type,$value) 3、修改部分bug
<?php namespace iter; use iter\fn; use PHPUnit\Framework\TestCase; class IterFnTest extends TestCase { public function testIndex() { $getIndex3 = fn\index(3); $getIndexTest = fn\index('test'); $arr1 = [10, 11, 12, 13, 14, 15]; $arr2 = ['foo' => 'bar', 'test' => 'tset', 'bar' => 'foo']; $this->assertSame($arr1[3], $getIndex3($arr1)); $this->assertSame($arr2['test'], $getIndexTest($arr2)); } public function testNestedIndex() { $getIndexFooBar = fn\nested_index('foo', 'bar'); $getIndexFooBarBaz = fn\nested_index('foo', 'bar', 'baz'); $getEmptyIndex = fn\nested_index(); $array = [ 'foo' => [ 'bar' => [ 'baz' => 42 ] ] ]; $this->assertSame($array['foo']['bar'], $getIndexFooBar($array)); $this->assertSame($array['foo']['bar']['baz'], $getIndexFooBarBaz($array)); $this->assertSame($array, $getEmptyIndex($array)); }这是一个生成器提供迭代原语的PHP库,需要的朋友可以直接下载使用,十分的方便。
<?php spl_autoload_register(function ($className) { $prefix = 'galapagos\'; $basePath = __DIR__.'/src/'; if (strncmp($prefix, $className, strlen($prefix)) === 0) { require $basePath.str_replace('\', '/', substr($className, strlen($prefix))).'.php'; } }); require __DIR__.'/src/core.php'; require __DIR__.'/src/php54.php';这是一个语言转换进化的PHP库,需要的朋友可以直接下载使用。
<?php BILITY OF SUCH DAMAGE. */ namespace Hoa\Eventsource; use Hoa\Exception as HoaException; /** * Class \Hoa\Eventsource\Exception. * * Extending the \Hoa\Exception\Exception class. * * @copyright Copyright © 2007-2017 Hoa community * @license New BSD License */ class Exception extends HoaException { }前段时间在考虑怎么把我们的自动部署工具 essay 包一层web的壳,这样每次发版就不用敲很多命令了,只需要点几个按钮就搞定,也可以减少发版是的心智负担。在做的时候主要的一个问题是如何更好的把本来在Terminal上输出的结果实时的输出到web界面上,最后发现了EventSource这个东西,除了IE浏览器不支持,其他浏览器都内置这个对象,可以很好得完成我的这个需求。于是就有了这个Eventsource-masterPHP事件源库,非常的好用,需要的朋友可以下载使用。
<?php require 'vendor/autoload.php'; use Jenssegers\Date\Date; $translations = array(); foreach ($months as $month) { $date = new Date($month); $translation = strftime('%B', $date->getTimestamp()); $translations[$month] = $translation; echo "'" . $month . "'\t=> '" . $translation . "',\n"; } echo "\n"; foreach ($days as $day) { $date = new Date($day); $translation = strftime('%A', $date->getTimestamp()); $translations[$day] = $translation; echo "'" . $day . "'\t=> '" . $translation . "',\n"; }这个库是多国语言组成的PHP,使用哪个国家的语言可以直接进行调用,十分的方便。
<?php namespace igorw; class ComposeTest extends \PHPUnit_Framework_TestCase { /** * @expectedException InvalidArgumentException */ function testComposeWithoutArgs() { compose(); } function testComposeWithSingleFunc() { $id = function ($x) { return $x; }; $composed = compose($id); $this->assertNull($composed(null)); $this->assertTrue($composed(true)); $this->assertFalse($composed(false)); $this->assertSame('foo', $composed('foo')); } function testComposeWithMultipleFuncs() { $composed = compose( function ($x) { return "baz($x)"; }, function ($x) { return "bar($x)"; }, function ($x) { return "foo($x)"; } ); $this->assertSame('baz(bar(foo(x)))', $composed('x')); }Compose是Docker的服务编排工具,主要用来构建基于Docker的复杂应用,Compose 通过一个配置文件来管理多个Docker容器,非常适合组合使用多个容器进行开发的场景。
<?php use Tackk\Cartographer\AbstractSitemap; class MockAbstractSitemap extends AbstractSitemap { protected function getRootNodeName() { return 'urlset'; } protected function getNodeName() { return 'url'; } } class AbstractSitemapTest extends PHPUnit_Framework_TestCase { /** * @var Tackk\Cartographer\AbstractSitemap */ protected $abstractMock; public function setUp() { $this->abstractMock = new MockAbstractSitemap(); } public function testFormatDateWithDates() { $this->assertEquals('2005-01-01T00:00:00+00:00', $this->callProtectedMethod('formatDate', ['2005-01-01'])); $this->assertEquals('2005-01-01T00:00:01+00:00', $this->callProtectedMethod('formatDate', ['2005-01-01 12:00:01am'])); }Google Cartographer利用同步定位与建图技术绘制室内建筑平面图,可以用于二维和三维空间的建图,可以在非ros(机器人操作系统)系统和ros系统中使用。根据google的说明,该技术易于部署机器人、无人驾驶、无人机等系统。Google在官方声明中提到,Cartographer的SLAM算法结合了来自多个传感器的数据,比如LiDAR激光雷达传感器、IMU惯性测量单元,还有来自多个摄像头的数据。综合这些庞杂的数据,得以计算传感器及传感器周围的环境。据报道Cartographer现已经支持Toyota HSR、TurtleBots、PR2、RevoLDS这几个机器人平台。
<?php namespace SensioLabs\AnsiConverter\Tests; use SensioLabs\AnsiConverter\AnsiToHtmlConverter; class AnsiToHtmlConverterTest extends \PHPUnit_Framework_TestCase { /** * @dataProvider getConvertData */ public function testConvert($expected, $input) { $converter = new AnsiToHtmlConverter(); $this->assertEquals($expected, $converter->convert($input)); } public function getConvertData() { return array( // text is escaped array('<span style="background-color: black; color: white">foo <br /></span>', 'foo <br />'), // newlines are preserved array("<span style=\"background-color: black; color: white\">foo\nbar</span>", "foo\nbar"), // backspaces array('<span style="background-color: black; color: white">foo </span>', "foobar\x08\x08\x08 "), array('<span style="background-color: black; color: white">foo</span><span style="background-color: black; color: white"> </span>', "foob\e[31;41ma\e[0mr\x08\x08\x08 "), // color array('<span style="background-color: darkred; color: darkred">foo</span>', "\e[31;41mfoo\e[0m"), // color with [m as a termination (equivalent to [0m]) array('<span style="background-color: darkred; color: darkred">foo</span>', "\e[31;41mfoo\e[m"), // bright color array('<span style="background-color: red; color: red">foo</span>', "\e[31;41;1mfoo\e[0m"), // carriage returns array('<span style="background-color: black; color: white">foobar</span>', "foo\rbar\rfoobar"), // underline array('<span style="background-color: black; color: white; text-decoration: underline">foo</span>', "\e[4mfoo\e[0m"), // non valid unicode codepoints substitution (only available with PHP >= 5.4) PHP_VERSION_ID < 50400 ?: array('<span style="background-color: black; color: white">foo '."\xEF\xBF\xBD".'</span>', "foo \xF4\xFF\xFF\xFF"), ); } }ANSI是一种字符代码,为使计算机支持更多语言,通常使用 0x00~0x7f 范围的1 个字节来表示 1 个英文字符。超出此范围的使用0x80~0xFFFF来编码,即扩展的ASCII编码。HTML则是超文本标记语言,标准通用标记语言下的一个应用。“超文本”就是指页面内可以包含图片、链接,甚至音乐、程序等非文字元素。超文本标记语言的结构包括“头”部分(英语:Head)、和“主体”部分(英
<?php namespace PhpAmqpLib\Channel; use PhpAmqpLib\Exception\AMQPBasicCancelException; use PhpAmqpLib\Exception\AMQPProtocolChannelException; use PhpAmqpLib\Exception\AMQPRuntimeException; use PhpAmqpLib\Message\AMQPMessage; use PhpAmqpLib\Wire\AMQPReader; use PhpAmqpLib\Wire\AMQPWriter; class AMQPChannel extends AbstractChannel { /** @var array */ public $callbacks = array(); /** @var bool Whether or not the channel has been "opened" */ protected $is_open = false; /** @var int */ protected $default_ticket; /** @var bool */ protected $active; /** @var array */ protected $alerts; /** @var bool */ protected $auto_decode;AMQP,即Advanced Message Queuing Protocol,一个提供统一消息服务的应用层标准高级消息队列协议,是应用层协议的一个开放标准,为面向消息的中间件设计。基于此协议的客户端与消息中间件可传递消息,并不受客户端/中间件不同产品,不同的开发语言等条件的限制。Erlang中的实现有 RabbitMQ等。
<?php $error_level = E_ALL & E_STRICT; ini_set('error_reporting', $error_level); ini_set('display_errors', 1); $tcryptoLocation = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'TCrypto'; require $tcryptoLocation . DIRECTORY_SEPARATOR . 'Loader.php'; require 'apps.php'; $loader = new TCrypto\Loader(); $loader->register(); $settings = new TCrypto\Tools\SettingStore(); $cli = new TCrypto\Tools\Cli\Horde\Cli(); if (file_exists('keytool.config.php')) { $optionParser = new TCrypto\Tools\ArrayOptionParser('keytool.config.php'); }TCrypto是可以很方便加密解密的库,可以使用它来对需要在网络中传输的数据加密。可以使用非对称加密:公钥加密,私钥解密。openssl提供了对RSA的支持,但RSA存在计算效率低的问题,所以一般的做法是使用对称密钥加密数据,然后再把这个只在当前有效的临时生成的对称密钥用非对称密钥的公钥加密之后传递给目标方,目标方使用约定好的非对称密钥中的私钥解开,得到数据加密的密钥,再进行数据解密,得到数据,这种使用方式很常见,可以认为是对HTTPS的裁剪。对称密钥加密可以选择AES,比DES更优秀。 下载源码之后,开始编译: 产生动态库的做法:1、安装ActivePerl2、进入OpenSSL所在文件夹,运行:perl Configure VC-WIN32 --prefix=C:\openssl-dll3、进入VC/BIN目录,运行 VCVARS32.BAT 设置环境变量4、返回OpenSSL目录,运行 ms\do_ms5、在OpenSSL目录下执行编译 nmake -f ms\ntdll.mak6、把必要生成物拷贝到prefix定义的目录中 nmake -f ms\ntdll.mak install注意:可以通过修改ntdll.mak文件中的CFLAG,确定编译MT、MD库 产生静态库的做法:1、安装ActivePerl2、perl configure VC-WIN32 --prefix=C:\openssl-lib3、ms\do_ms.bat4、nmake -f ms\nt.mak5、nmake -f ms\nt.mak install注意:可以通过修改nt.mak文件中的CFLAG,确定编译MT、MD库。重编的时候把生成物删掉。
SecurityMultiTool-masterPHP安全库是一套易于使用、结构良好、速度出色且专门面向PHP类Web应用程序的先进安全层。这套入侵检测系统既不提供任何缓和及杀毒机制,也不会对恶意输入内容进行过滤,其作用单纯为识别出攻击者们针对站点进行的恶意活动、并以大家需要的方式作出及时提醒。凭借着一整套经过实践检验及相当严格的过滤规则,该检测系统会针对任何攻击活动给出一个影响评级数值,从而帮助用户更轻松地了解应如何应对当前出现的黑客攻击。具体应对方式多种多样,包括简单将日志纪录通过紧急邮件发送给开发团队、显示关于攻击者的警告消息甚至立即中止用户的当前会话。
伪数据生成器按照一定的数据规则,生成大量的数据,支持teradata数据导入和oracle数据导入。软件作用:为测试软件在大数据量下的性能而给数据库导入大量的数据。<?php namespace Samsui\Generator; use \Samsui\Provider\ProviderInterface; class Generator implements GeneratorInterface { protected $providers = array(); protected static $instance; /** * @param string $name */ public function registerProvider($name, ProviderInterface $provider) { $this->providers[$name] = $provider; } public function __get($name) { if (isset($this->providers[$name])) { return $this->providers[$name]; } }