環境:win10+phpstudy+微信開發工具;
技術:thinkphp+mysql
1、微信小程序本地開發調試方法:
A、微信小程序 本地開發
https://blog.csdn.net/woai671/article/details/82710834
https://blog.csdn.net/qq_24531461/article/details/79957150
B、微信小程序開發——本地調試 https://www.jianshu.com/p/569c6b7aa773
2、最終解決方案
A、採用阿里雲服務器、寶塔免費的SSL證書Let's Encrypt(SSL證書申請時間反應有點長啊,阿里雲虛擬主機不支持fastadmin的部分功能)。同時也免費申請了阿里的免費SLL證書
3、僞靜態:fastadmin+Ngix報這個錯誤:404 Not Found。在寶塔面板的僞靜態中選擇thinkphp自動生成僞靜態規則。錯誤消失。
apache開啓僞靜態的步驟: 配置文件httpd.conf,找到#LoadModule rewrite_module modules/mod_rewrite.so。把前面#去掉。沒有則添加,但必選獨佔一行,使apache支持 mod_rewrite 模塊。把 AllowOverride None 換成 AllowOverride All 使apache支持 .htaccess 文件
nginx開啓僞靜態的步驟:直接在nginx.conf (或者在對應的*.conf) 中找到需設置僞靜態規則的服務器對應字段,在server{ location/{ } }中添加以代碼。
寶塔中設置僞靜態不需要這麼麻煩,直接選擇生成。
4、_initialize() 區別 __construct()
_initialize()方法是在任何方法執行之前,都要執行的,當然也包括 __construct構造函數。 也就是說如果存在_initialize()函數,調用對象的任何方法都會導致_initialize()函數的自動調用,而__construct()構造函數僅僅在創建對象的時候調用一次,跟其它方法調用沒有關係。
__construct這裏是雙劃線,而_initialize()函數是單劃線
如果父子類均有_initialize()函數,則子類覆蓋了父類的,如果子類沒有而父類有,則子類繼承父類的。
默認情況下,子類的構造函數不會自動調用父類的構造函數。在調用子類對象的_initialize()時,也不會導致自動調用父類的_initialize()
實際編寫子類的構造函數時,一般都要加上父類構造函數的主動調用parent::__construct(),否則會導致子類對象空指針的異常,如Call to a member function assign() on a non-object。
5、PHP類中的$this、self、parent關鍵字使用總結 https://www.cnblogs.com/Cloudloong/p/9564425.html
6、{:__('abc')}表示 語言包標籤
7、addons.php 中的 sms_send 對應調用插件中的 Qcloudsms.php中的 smsSend方法
8、
<input id="c-category_ids" data-rule="required" data-source="category/selectpage" data-params='{"custom[type]":"test"}' data-multiple="true" class="form-control selectpage" name="row[category_ids]" type="text" value="">
data-rule: 在FastAdmin當中我們只需要給元素添加data-rule="規則"即可開啓Nice-validator的驗證
data-source: FastAdmin中的動態下拉列表使用的是優秀強大的Selectpage插件來支持,其中需要給元素class添加一個selectpage,其次需要增加一個data-source="category/selectpage"這個屬性,category/selectpage爲我們控制器提交列表的方法
data-params: 爲Selectpage所支持的擴展屬性。
data-params='{"custom[type]":"test"}' : 表示搜索type字段,內容爲test的記錄。
9、fastadmin 命令行工具
1)、一級目錄操作
php think crud -t zhaoshang_type -u 1 CRUD且一鍵生成菜單
php think crud -t zhaoshang_type -d 1 刪除CRUD
php think menu -c zhaoshang_type -d 1 刪除菜單
2)、二級目錄操作
php think crud -t zhaoshang_type -c zhaoshang/type CRUD且控制器生成在二級目錄下(注意控制器不能有下劃線,TP中會做峯駝轉換,各種意外 )
php think menu -c zhaoshang/type 一鍵生成mydir/test控制器的權限菜單
php think crud -t zhaoshang_type -c zhaoshang/type -d 1 刪除CRUD
php think menu -c zhaoshang/type -d 1 刪除菜單
3)、關聯模型
php think crud -t 主表 -r 關聯表 -k 關聯id -p 關聯模型表主鍵 -c 目錄/文件名 -u 1
php think crud -t zhaoshang_list -r zhaoshang_type -k channel_id -p id -c zhaoshang/listdata -u 1 新建二級目錄 關聯模型
php think crud -t zhaoshang_type -c zhaoshang/type
php think menu -c zhaoshang/type
具體應用
php think crud -t zhaoshang_type -c zhaoshang/type -d 1 刪除CRUD
php think crud -t zhaoshang_list -c zhaoshang/listdata -d 1 刪除CRUD
php think menu -c zhaoshang/type -d 1 刪除菜單
php think menu -c zhaoshang/listdata -d 1 刪除菜單
php think menu -c zhaoshang -d 1 刪除菜單
php think crud -t test -c mydir/test -d 1 刪除測試表CRUD
php think menu -c mydir/test -d 1 刪除測試表菜單
php think menu -c mydir -d 1 刪除菜單
總體上參考資料
https://ask.fastadmin.net/article/324.html
https://doc.fastadmin.net/docs/addons.html#toc-1
https://ask.fastadmin.net/questions.html
https://www.kancloud.cn/manual/thinkphp5_1/353946
www.baidu.com
新問題探索方向:
1、https://ask.fastadmin.net/article/6504.html
https://ask.fastadmin.net/question/656.html
2、通過test命令來排除法
3、通過已有插件案例來排除法研究系統