Giter VIP home page Giter VIP logo

codeigniter-weixin_library's Introduction

CodeIgniter-Weixin_Library

即插即用微信网页授权模块, 适用于CodeIgniter框架。

开发测试环境 CI 3.0.6

起步

该模块为即插即用模块, 只需下载release即可开始使用

目录结构

CodeIgniter-Weixin_Library/
├── config/
│   └── wx_library.php
├── libraries/
│   └── Wx_library.php
└── third_party/
    └── weixin/
        └── ...

安装

将项目中的:

  • config/wx_library.php文件放入你的项目中application/config/目录
  • libraries/Wx_library.php文件放入你的项目中application/libraries/目录
  • third_party/weixin/目录放入你的项目中application/third_party/目录

加载和使用

配置

修改wx_library.php配置文件, 填入所开发公众号的信息:

<?php
/*
|--------------------------------------------------------------------------
| 微信公众号配置
|--------------------------------------------------------------------------
|
| 参数须与微信公众平台一致
|
*/
$config['appid']  = ''; // 必填
$config['secret'] = ''; // 必填
$config['token']  = '';

加载

在你的controller中, 使用$this->load->library()来加载该库

// controller
// (建议将别名设为`wx`)
$this->load->library('Wx_library', null, 'wx')

API

Wx_library提供2个API:

// 获取当前微信用户
$this->wx->getWxUser();

// 返回微信 js sdk 配置选项 signPackage
$this-wx->signPackage();

Note

你的项目根目录需要有读写权限, Wx_library才能更好地工作。因为它需要在文件中缓存access_tokenjsapi_ticket

License

MIT License. Check the LICENSE file.

codeigniter-weixin_library's People

Contributors

sevenoutman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.