常用扩展列表1、队列任务 composer require topthink/think-queue2、workerman composer require topthink/think-worker3、多媒体文件 composer require james-heinrich/getid3 4、汉字转拼音 composer require overtrue/pinyin5、文档处理 composer phpoffice/phpspreadsheet6、发送邮件 composer require txthinking/mailer7、网页爬取 composer require jaeger/querylist8、html转pdf composer require tecnickcom/tcpdf
1、安装node环境2、安装插件:npm install puppeteer 安装插件3、创建抓取文件,如:index.js, 代码如下const puppeteer = require('puppeteer'); async function test(url) { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto(url, { waitUntil: 'networkidle2' }); const content = await page.content(); await browser.close(); return content;} test('https://baidu.com').then(content => { console.log(content); });
引入方法:composer require tecnickcom/tcpdfgithub官方链接:https://github.com/tecnickcom/TCPDF <?php use TCPDF; $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->setPrintHeader(false); //页眉 $pdf->setPrintFooter(false); //页脚 $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); 默认边距 $pdf->SetAutoPageBreak(true, 5); //距离底部进行分页 $pdf->setCellHeightRatio(1); //行高 $pdf->SetFont('stsongstdlight', '', 12); //这个字体兼容性强。中文也支持 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setFontSubsetting(true); $pdf->SetMargins(5, 5, 5, true); //边距 $pdf->AddPage("A4","Landscape",true,true); //页面设置 $pdf->writeHTML($this->getHtml($order, $jsTime, $companyName), true, false, true, false, ''); //$this->getHtml() 获取html自定义方法 $fileName = '结算单-pdf-'.time().'.pdf'; $path = ROOT_PATH.'public/uploads/'.date('YMd'); if(!is_dir($path)) { mkdir($path, 0777, true); } $path .= '/'.$fileName; $pdf->Output($path, 'F'); 没有返回值 用file_exists 判读文件是否生成
Mac docker 宝塔面板安装下载docker ,并安装。启动mac终端。获取docker镜像docker pull pch18/baota:clear创建volume数据卷docker volume create baota启动容器docker run -tid --name baota -p 80:80 -p 443:443 -p 8888:8888 -p 888:888 -p 8022:8022 -p 3306:3306 --privileged=true --shm-size=1g --restart always -v baota:/www -v ~/wwwroot:/www/wwwroot pch18/baota:clear进入容器docker exec -it baota /bin/bash输入bt,修改宝塔登陆密码及登陆用户名登陆宝塔面板 http://127.0.0.1:8888/login
electron 创建app1、安装node.js 环境2、创建app命令 npm create electron-app app 该命令可以自动安装部分依赖。3、npm run start 启动应用,如启动失败,重新安装electron依赖 npm install electron --save-dev 再重新启动即可4、npm install electron-builder --save-dev 安装完成后,package.json中scripts里配置 "build": "electron-builder" 5、npm run build 即可根据当前系统来打包,并生成当前系统对应的安装包
按照文件扩展名排列的 Mime 类型列表扩展名类型/子类型application/octet-stream323text/h323acxapplication/internet-property-streamaiapplication/postscriptaifaudio/x-aiffaifcaudio/x-aiffaiffaudio/x-aiffasfvideo/x-ms-asfasrvideo/x-ms-asfasxvideo/x-ms-asfauaudio/basicavivideo/x-msvideoaxsapplication/olescriptbastext/plainbcpioapplication/x-bcpiobinapplication/octet-streambmpimage/bmpctext/plaincatapplication/vnd.ms-pkiseccatcdfapplication/x-cdfcerapplication/x-x509-ca-certclassapplication/octet-streamclpapplication/x-msclipcmximage/x-cmxcodimage/cis-codcpioapplication/x-cpiocrdapplication/x-mscardfilecrlapplication/pkix-crlcrtapplication/x-x509-ca-certcshapplication/x-cshcsstext/cssdcrapplication/x-directorderapplication/x-x509-ca-certdirapplication/x-directordllapplication/x-msdownloaddmsapplication/octet-streamdocapplication/msworddotapplication/msworddviapplication/x-dvidxrapplication/x-directorepsapplication/postscriptetxtext/x-setextevyapplication/envoyexeapplication/octet-streamfifapplication/fractalsflrx-world/x-vrmlgifimage/gifgtarapplication/x-gtargzapplication/x-gziphtext/plainhdfapplication/x-hdfhlpapplication/winhlphqxapplication/mac-binhex40htaapplication/htahtctext/x-componenthtmtext/htmlhtmltext/htmlhtttext/webviewhtmlicoimage/x-iconiefimage/iefiiiapplication/x-iphoneinsapplication/x-internet-signupispapplication/x-internet-signupjfifimage/pipegjpeimage/jpegjpegimage/jpegjpgimage/jpegjsapplication/x-javascriptlatexapplication/x-latexlhaapplication/octet-streamlsfvideo/x-la-asflsxvideo/x-la-asflzhapplication/octet-streamm13application/x-msmediaviewm14application/x-msmediaviewm3uaudio/x-mpegurlmanapplication/x-troff-manmdbapplication/x-msaccessmeapplication/x-troff-memhtmessage/rfc822mhtmlmessage/rfc822midaudio/midmnyapplication/x-msmoneymovvideo/quicktimemovievideo/x-sgi-moviemp2video/mpegmp3audio/mpegmpavideo/mpegmpevideo/mpegmpegvideo/mpegmpgvideo/mpegmppapplication/vnd.ms-projectmpv2video/mpegmsapplication/x-troff-msmvbapplication/x-msmediaviewnwsmessage/rfc822odaapplication/odap10application/pkcs10p12application/x-pkcs12p7bapplication/x-pkcs7-certificatesp7capplication/x-pkcs7-mimep7mapplication/x-pkcs7-mimep7rapplication/x-pkcs7-certreqrespp7sapplication/x-pkcs7-signaturepbmimage/x-portable-bitmappdfapplication/pdfpfxapplication/x-pkcs12pgmimage/x-portable-graymappkoapplication/ynd.ms-pkipkopmaapplication/x-perfmonpmcapplication/x-perfmonpmlapplication/x-perfmonpmrapplication/x-perfmonpmwapplication/x-perfmonpnmimage/x-portable-anymappot,application/vnd.ms-powerpointppmimage/x-portable-pixmapppsapplication/vnd.ms-powerpointpptapplication/vnd.ms-powerpointprfapplication/pics-rulespsapplication/postscriptpubapplication/x-mspublisherqtvideo/quicktimeraaudio/x-pn-realaudioramaudio/x-pn-realaudiorasimage/x-cmu-rasterrgbimage/x-rgbrmiaudio/midroffapplication/x-troffrtfapplication/rtfrtxtext/richtextscdapplication/x-msschedulescttext/scriptletsetpayapplication/set-payment-initiationsetregapplication/set-registration-initiationshapplication/x-shsharapplication/x-sharsitapplication/x-stuffitsndaudio/basicspcapplication/x-pkcs7-certificatessplapplication/futuresplashsrcapplication/x-wais-sourcesstapplication/vnd.ms-pkicertstorestlapplication/vnd.ms-pkistlstmtext/htmlsvgimage/svg+xmlsv4cpioapplication/x-sv4cpiosv4crcapplication/x-sv4crcswfapplication/x-shockwave-flashtapplication/x-trofftarapplication/x-tartclapplication/x-tcltexapplication/x-textexiapplication/x-texinfotexinfoapplication/x-texinfotgzapplication/x-compressedtifimage/tifftiffimage/tifftrapplication/x-trofftrmapplication/x-msterminaltsvtext/tab-separated-valuestxttext/plainulstext/iulsustarapplication/x-ustarvcftext/x-vcardvrmlx-world/x-vrmlwavaudio/x-wavwcmapplication/vnd.ms-workswdbapplication/vnd.ms-workswksapplication/vnd.ms-workswmfapplication/x-msmetafilewpsapplication/vnd.ms-workswriapplication/x-mswritewrlx-world/x-vrmlwrzx-world/x-vrmlxafx-world/x-vrmlxbmimage/x-xbitmapxlaapplication/vnd.ms-excelxlcapplication/vnd.ms-excelxlmapplication/vnd.ms-excelxlsapplication/vnd.ms-excelxltapplication/vnd.ms-excelxlwapplication/vnd.ms-excelxofx-world/x-vrmlxpmimage/x-xpixmapxwdimage/x-xwindowdumpzapplication/x-compresszipapplication/zip
brew 常用命令brew update 更新 Homebrewbrew search package 搜索软件包brew install package 安装软件包brew uninstall package 卸载软件包brew upgrade 升级所有软件包brew upgrade package 升级指定软件包brew list 列出已安装的软件包列表brew services command package 管理 brew 安装软件包brew services list 列出 brew 管理运行的服务brew info package 查看软件包信息brew deps package 列出软件包的依赖关系brew help 查看帮助brew cleanup 清除过时软件包brew link package 创建软件包符号链接brew unlink package 取消软件包符号链接brew doctor 检查系统是否存在问题
自动脚本(全部国内地址)(复制下面一句脚本到终端中粘贴回车)苹果电脑 常规安装脚本(推荐 完全体 几分钟安装完成):/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"苹果电脑 极速安装脚本(精简版 几秒钟安装完成):/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" speed苹果电脑 卸载脚本:/bin/zsh -c "$(curl -fsSLLinux电脑 安装脚本:rm Homebrew.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh ; bash Homebrew.shLinux电脑 卸载脚本:rm HomebrewUninstall.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh ; bash HomebrewUninstall.sh
上传图片/标题/链接<?php/*Plugin Name: 广告管理面板Plugin URI: Description: wordpress下广告图片自定义管理。Author: 安馨软服科技Version: 0.0.1Author URI: Requires PHP: 7.0.0*/function ad_management_panel($wp_customize) { $wp_customize->add_panel('ad_management_panel', array( 'priority' => 200, 'theme_supports' => '', 'title' => '广告面板', 'discription' => 'wordpress下广告图片自定义管理' )); $num = get_theme_mod('ad_num'); $num = intval($num) > 0 ? $num : 5; for($i = 0; $i < $num; $i++) { $wp_customize->add_section('ad_list'.$i, array( 'title' => '广告 '.$i, 'panel' => 'ad_management_panel', 'priority' => 130 )); $wp_customize->add_setting('ad_upload_'.$i, array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'absint', 'type' => 'theme_mod' )); $wp_customize->add_control(new WP_Customize_Media_Control($wp_customize, 'ad_upload_'.$i, array( 'label' => __('文章广告投放'), 'description' => __('位置'.$i), 'section' => 'ad_list'.$i, 'settings' => 'ad_upload_'.$i, 'priority' => 1, 'mime_type' => 'video', 'button_labels' => array( 'select' => '选择图片', 'change' => '更换图片', 'default' => '默认', 'remove' => '删除图片', 'placeholder' => '请选择图片', 'frame_title' => '请选择文件', 'frame_button' => '请选择文件' ) )) ); $wp_customize->add_setting('ad_poster'.$i, array( 'default' => plugin_dir_url(__FILE__).'images/default.jpg', 'transport' => 'refresh', 'type' => 'theme_mod' )); // $wp_customize->add_control(new WP_Customize_Cropped_Image_Control('ad_poster'.$i, array( // 'label' => '请选择图片', // 'height' => 40, // 'width' => 70, // 'flex_height' => true, // 'flex_width' => true, // 'section' => 'ad_list'.$i, // 'settings' => 'ad_poster'.$i, // 'priority' => 1 // ))); $wp_customize->add_setting('ad_title'.$i, array( 'default' => '', 'type' => 'theme_mod', )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'ad_title'.$i, array( 'label' => '标题', 'section' => 'ad_list'.$i, 'settings' => 'ad_title'.$i, 'priority' => 1, 'type' => 'text', 'placeholder' => '请输入标题' ))); $wp_customize->add_setting('ad_url'.$i, array( 'default' => '', 'type' => 'theme_mod', )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'ad_url'.$i, array( 'label' => '跳转地址', 'section' => 'ad_list'.$i, 'settings' => 'ad_url'.$i, 'priority' => 1, 'type' => 'text', 'placeholder' => '请输入跳转链接' ))); } $wp_customize->add_section('ad_set', array( 'title' => '广告位设置', 'panel' => 'ad_management_panel', 'priority' => 130 )); $wp_customize->add_setting('ad_num', array( 'default' => '', 'type' => 'theme_mod', )); $wp_customize->add_control(new WP_Customize_Control($wp_customize, 'ad_num', array( 'label' => '广告位数量', 'section' => 'ad_set', 'settings' => 'ad_num', 'priority' => 1, 'type' => 'text', 'placeholder' => '请输入广告位数量' )));}add_action('customize_register', 'ad_management_panel');add_shortcode('ad_show', 'adSHowList');function adSHowList() { $num = get_theme_mod('ad_num'); $ad_data = []; if(is_numeric($num)) { for($i = 0; $i < $num; $i++) { $id = get_theme_mod('ad_upload_'.$i); if($id) { $ad_data[] = [ 'img' => wp_get_attachment_url($id) ?? '', 'title' => get_theme_mod('ad_title'.$i) ?? '', 'jump' => get_theme_mod('ad_url'.$i) ?? '' ]; } } } return $ad_data;}//$id = get_theme_mod('ad_poster'.$i);获取id//wp_get_attachment_url($id); 获取附件地址
队列消息配置队列消息用于订单自动关闭及自动评价,以及拼团活动完成等1. 宝塔软件商店搜索安装Supervisor2. 点击添加守护进程,添加高优先级守护进程进程,填写信息如下:名称为域名前缀_high,如shopro_high启动用户设置为www运行目录选择新增项目目录,如/www/wwwroot/shop.asyt.top/启动命令填写 php think queue:listen --queue=shopro-high进程数填写:1或23. 点击添加守护进程,添加普通优先级守护进程进程,填写信息如下:名称为域名前缀,如shopro启动用户设置为www运行目录选择新增项目目录,如/www/wwwroot/shop.asyt.top/启动命令填写 php think queue:listen --queue=shopro进程数填写:14. 运行成功