update-alternatives设置 php 版本

sudo update-alternatives --install /usr/bin/php php /usr/bin/php7.4 74
sudo update-alternatives --install /usr/bin/php php /usr/bin/php8.0 80
sudo update-alternatives --install /usr/bin/php php /usr/bin/php8.1 81

配置默认版本

update-alternatives --config php

配置自动选择最高版本

 update-alternatives --auto php

直接设置指定版本

update-alternatives --set php /usr/bin/php8.1

Linux 安装composer备忘录

安装

curl -sSL https://getcomposer.org/installer |  php -- --install-dir=/usr/bin --filename=composer

更新源, -g 参数是全局,取消则是当前项目

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

撤销设置

composer config -g --unset repos.packagist

升级

composer self-update

执行诊断命令:

composer diagnose

清除缓存:

composer clear

若项目之前已通过其他源安装,则需要更新 composer.lock 文件,执行命令:

composer update --lock

macOS下使用fswatch配合VScode 终端rsync同步更新

安装fswatch

brew install fswatch

VScode 终端运行脚本

cd local_path
running=true
   while $running; do
    echo '-------------'
    fswatch -r -L -1 *
    date
    rsync -avP --omit-dir-times --no-perms --no-group --no-owner --progress  -e 'ssh -p 2222'  ./ username@host:/destination_path/
# git push   
done &

运行脚本可以修改加入 git提交

Stripe alipay wechat_pay 创建支付接口

#composer require stripe/stripe-php

<?php
require_once('vendor/autoload.php');

$skapi='sk_live_KEY';
$stripe = new  \Stripe\StripeClient($skapi);

//wechat_pay和 alipay 二选一
//$Methodtype = 'wechat_pay';
$Methodtype = 'alipay';

$paymentMethod = $stripe->paymentMethods->create(['type' => $Methodtype]);

$paymentIntentParams = [
    'amount' => 1000,  // 金额,单位为最小货币单位(1000 为 10 元人民币)
    'currency' => 'cny',
    'payment_method' => $paymentMethod->id,
    'payment_method_types' => [$Methodtype],
    'confirmation_method' => 'manual', // 手动确认支付
    'confirm' => true, // 直接确认支付
    'return_url' => 'https://your-return-url.com' // 支付完成后的跳转 URL
];

if ($Methodtype = 'wechat_pay') {
	$paymentIntentParams['payment_method_options']['wechat_pay']['client']='web';
}

$paymentIntent = $stripe->paymentIntents->create($paymentIntentParams);

if (isset($paymentIntent->next_action->alipay_handle_redirect->url)) {
	print_r($paymentIntent->next_action->alipay_handle_redirect->url);
}

if (isset($paymentIntent->next_action->wechat_pay_display_qr_code->image_data_url)) {
	print_r($paymentIntent->next_action->wechat_pay_display_qr_code->image_data_url);
}

//$paymentIntent = $stripe->paymentIntents->retrieve($paymentIntent->id);
//print_r($paymentIntent);

 

支付宝 Tips

支付宝的native_url为空 可以补全为 https://intlmapi.alipay.com/gateway.do?

native_url 加上native_data 可以实现手机 app 唤醒支付

$paymentIntent->next_action->alipay_handle_redirect->native_data

微信 Tips

微信内部支付引用 data

$paymentIntent->next_action->wechat_pay_display_qr_code->data  

image_data_url为 base64 的二维码 png 图片

 

更多数据查看$paymentIntent 

 

反编译VUE打包项目获取源代码

nodejs安装reverse-sourcemap 后对map文件进行逆向(css也是同样操作)

npm install --global reverse-sourcemap
npm install typescript@latest
reverse-sourcemap --output-dir src app.xxxxx.js.map  #逆向JS
reverse-sourcemap --output-dir src app.xxxxx.css.map  #逆向CSS

取得TypeScript的ts文件后用tsc命令转换JavaScript获得js文件

tsc xxx.ts

最后会得到一个xxx.js的文件