最近公司的一款产品需要用到微信小程序的带参数的二维码。虽然微信提供了现成的API,但是整个过程中有非常多的坑。
微信的官方文档:获取二维码 · 小程序
获取Access Token
获取二维码的接口需要用到应用的Access Token。只需要向微信的提供的接口发送AppID
和AppSecret
即可获得Access Token。每个Access Token的有效期为7200秒,我们的方案是获取到Access Token之后将其写入Redis并设置7200秒的过期时间。
在今年10月初的Made by Google 发布会上,Google发布了早在6月的I/O大会上就提及了的Daydream VR平台。
购买
10月中旬,Daydream 已经上线包括Google Store、Verizon、BestBuy在内的美国各大线上平台。
我10月中旬在Google Store下单了一台Slate颜色的Daydream View。11月中旬从位于Mira Loma的Google仓库发货,经过4天的运输到达转运公司仓库,再经过大约10天的国际转运,清关,国内转运等等流程,在11月26号到达我的手中。
总共的花费大约是标价79刀 + 税6刀 + 运费80软妹币。
开箱
包裹和国际运单
Daydream包装
Daydream View本体和控制器
Daydream控制器上有一个可点击的触控板,一个APP按钮,一个Home按钮,和音量键。使用USB C接口充电。
安装
composer global require "laravel/installer"
Laravel 可执行文件位于$HOME/.composer/vendor/bin
使用laravel new
创建新项目
laravel new blog
配置
目录权限
Directories within the storage
and the bootstrap/cache
directories should be writable by your web server or Laravel will not run.
Application Key
在.env
配置文件中设置 Application Key,它应该有32 个字符长。
使用
php artisan key:generate
生成一个key。
美化链接
Laravel自带.htaccess
文件,需要开启Apache的mod_rewrite
模块
– nginx配置
location / { try_files $uri $uri/ /index.php?$query_string; }
Composer
是 PHP 的一个依赖管理工具。它允许你申明项目所依赖的代码库,它会在你的项目中为你安装他们。
安装
curl -sS https://getcomposer.org/installer | php
让 composer 可以在全局进行调用
mv composer.phar /usr/local/bin/composer
将官方数据源修改为国内镜像
composer config -g repo.packagist composer https://packagist.phpcomposer.com
我校校园网使用的是网页Portal认证,需要使用curl之类的命令模拟浏览器请求来实现自动登录。
抓取POST请求
在点击登录前打开Chrome审查元素,在Network选项卡中勾上Preserve Log
。
点击登录,选中登录时发送的请求,即可获取POST的表单内容。
使用wget命令
wget -O - https://wlgn.bjut.edu.cn/ --user-agent=Mozilla/5.0 --post-data "DDDDD=[用户名]&upass=[密码]&6MKKey=123"
使用curl命令
curl -d "DDDDD=[用户名]&upass=[密码]&6MKKey=123" "https://wlgn.bjut.edu.cn"
在Android上使用curl和wget
Android的BusyBox不自带curl,wget命令则十分老旧且充满bug。因此,不建议使用Android的BusyBox上自带的命令。
Termux是一个包含apt
包管理器的,极其强大的终端模拟器。安装Termux后,使用apt install
安装相关命令或依赖,然后即可使用上述方法实现自动登录校园网。
如果需要桌面快捷方式,需要另外购买Termux:Widget插件。
从压缩文档安装
Installing Yii from an archive file involves three steps:
- Download the archive file from yiiframework.com.
- Unpack the downloaded file to a Web-accessible folder.
- Modify the config/web.php file by entering a secret key for the cookieValidationKey configuration item (this is done automatically if you are installing Yii using Composer):
'cookieValidationKey' => 'enter your secret key here',
- 使用浏览器访问
/basic/web/index.php
,如果有报错则根据报错信息解决错误。 - 执行
php yii server
运行yii的内置Web Server,默认运行在http://localhost:8080/
You should see the above “Congratulations!” page in your browser.
依赖:
sudo apt install php7.0-mbstring
git流程图
本地操作
初始化一个git仓库
git init
将文件加入/撤出暂存区
git add .
这个命令会将目录下所有文件加入git仓库,如果使用git add *
,则只会加入当前目录下的文件。
git reset HEAD < 文件>
将暂存区中的更改撤回至工作区,用于回滚add操作。
由于2016年网易云音乐的API变化,由旧API解析出的mp3文件URL全部失效。因此我基于musicbox项目中封装的新版API制作了这个下载器,用于通过歌曲,歌单或专辑id解析及下载mp3文件。
应用地址:https://nem-downloader.herokuapp.com/
源代码:https://github.com/nyanim/nem-downloader
API相关文档:https://github.com/darknessomi/musicbox/wiki/