码迷,mamicode.com
首页 > Windows程序 > 详细

win php composer安装

时间:2019-12-11 17:16:47      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:cse   oca   osi   strong   mes   point   aws   cti   安装文件   

composer安装文件下载

https://getcomposer.org/Composer-Setup.exe

 

composer安装:

选择php.exe

D:\phpStudy\php55n\php.exe

 

Compare

D:\phpStudy\php55n\php.ini
D:\phpStudy\php55n\php.ini~orig

++++

extension=php_openssl.dll

++++

 

查看composer版本

cmd
composer -V
Composer version 1.9.1 2019-11-01 17:20:17

 

设置composer

cmd
composer config -g repo.packagist composer https://packagist.phpcomposer.com composer clear-cache

 

利用composer为项目syhuo.net安装第三方包oss-sdk-php

cd E:\telpo\syhuo.net\syhuo.net
composer config -g repo.packagist composer https://packagist.phpcomposer.com
composer clear-cache

    发现composer.json被修改

    M E:\telpo\syhuo.net\syhuo.net\composer.json
        "repositories": {
            "packagist": {
                "type": "composer",
                "url": "https://mirrors.aliyun.com/composer/"
            }
        }

  composer require aliyuncs/oss-sdk-php

    M E:\telpo\syhuo.net\syhuo.net\composer.json
    "require" : {
            "elasticsearch/elasticsearch": "~2.0",
            "qcloud/cos-sdk-v5": ">=1.0",
            "aliyuncs/oss-sdk-php": "^2.3"
    },    

    M E:\telpo\syhuo.net\syhuo.net\composer.lock
    M E:\telpo\syhuo.net\syhuo.net\vendor\autoload.php
    M E:\telpo\syhuo.net\syhuo.net\vendor\composer\*
    A E:\telpo\syhuo.net\syhuo.net\vendor\aliyuncs\*

封装aliyuncs/oss-sdk-php接口

[root@VM_58_118_centos syhuo.net]# vim General/Classes/AcloudApi.php
<?php
namespace General\Classes;

/**
 * Acloud 接口类
 * @author 刘超 <249757247@qq.com> 2019-12-05
 */
class AcloudApi
{
    protected $config = [
        ‘accessyeyid‘     => ‘LTAI4Fm1GK7WAwgdkHgREBWT‘,
        ‘accesskeysecret‘  => ‘UxTwM4II0aWSFPhAPepcyDSM3iO9YJ‘,
        ‘endpoint‘ => ‘http://oss-accelerate.aliyuncs.com‘,
        ‘bucket‘    => ‘syhuo-1251970097‘,
        ];
    protected $ossClient = null;
    /**
     * [__construct description]
     * @author 刘超 <249757247@qq.com> 2019-12-05
     */
    public function __construct()
    {
        $ossClient = new \OSS\OssClient(
                $this->config[‘accessyeyid‘],
                $this->config[‘accesskeysecret‘],
                $this->config[‘endpoint‘]
                );
        $this->ossClient = $ossClient;
    }
    /**
     * [upload description]
     * @author 刘超 <249757247@qq.com> 2019-12-05
     * @param  string $keys  [description]
     * @param  string $bodys [description]
     * @return [type]        [description]
     */
    public function uploadfile($keys = ‘‘, $bodys = ‘‘)
    {
        try {
            //Uploads a local file to an OSS file
            $result = $this->ossClient->uploadFile(
                    $this->config[‘bucket‘],
                    ltrim($keys,‘/‘),
                    $bodys
                    );
            return $result;
        } catch (\OSS\Core\OssException $e) {
            print $e->getMessage();
        }

    }

    /**
     * [delete description]
     * @author 刘超 <249757247@qq.com> 2019-12-05
     * @param  [type] $key [description]
     * @return [type]      [description]
     */
    public function delete($key)
    {
        // Delete an object
        return $result = $this->ossClient->deleteObject(
                $this->config[‘bucket‘],
                ltrim($key,‘/‘)
                );
    }
}

win php composer安装

标签:cse   oca   osi   strong   mes   point   aws   cti   安装文件   

原文地址:https://www.cnblogs.com/hnhycnlc888/p/12023427.html

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