[Linux] 简单安装和使用composer

2018-10-19 06:16:05来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

wget https://getcomposer.org/installer  //下载一个脚本文件

php installer  //php执行下这个php脚本

mv composer.phar /usr/bin/composer   //下载的文件转移到执行目录

composer config -g repo.packagist composer https://packagist.laravel-china.org //解决下载慢,不要用https://packagist.phpcomposer.com

composer require overtrue/wechat:~4.0 -vvv   //例子

 

<?php
require_once(dirname(__FILE__)."/vendor/autoload.php");
use EasyWeChat\Factory;

$options = [ 
    'app_id'    => 'wx3cf0f39249eb0exxx',
    'secret'    => 'f1c242f4f28f735d4687abb469072xxx',
    'token'     => 'easywechat',
    'log' => [
        'level' => 'debug',
        'file'  => '/tmp/easywechat.log',
    ],  
    // ...
];

$app = Factory::officialAccount($options);

$server = $app->server;
$user = $app->user;

$server->push(function($message) use ($user) {
    $fromUser = $user->get($message['FromUserName']);

    return "{$fromUser->nickname} 您好!欢迎关注 overtrue!";
});

$server->serve()->send();

 

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:PHP面试题

下一篇:[Linker Error] Unresolved external &#39;_cvReleaseImage&