码迷,mamicode.com
首页 > 系统相关 > 详细

[Linux] 简单安装和使用composer

时间:2018-10-19 02:11:17      阅读:301      评论:0      收藏:0      [点我收藏+]

标签:div   tps   vendor   color   over   ESS   end   secret   usr   

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();

 

[Linux] 简单安装和使用composer

标签:div   tps   vendor   color   over   ESS   end   secret   usr   

原文地址:https://www.cnblogs.com/taoshihan/p/9813766.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!