書籤
分類
-
近期文章
近期迴響
彙整
- 2025 年 九月
- 2025 年 八月
- 2025 年 七月
- 2025 年 六月
- 2025 年 五月
- 2025 年 三月
- 2025 年 二月
- 2025 年 一月
- 2024 年 十二月
- 2024 年 十一月
- 2024 年 十月
- 2024 年 九月
- 2024 年 八月
- 2024 年 七月
- 2024 年 六月
- 2024 年 五月
- 2024 年 四月
- 2024 年 三月
- 2024 年 二月
- 2024 年 一月
- 2023 年 十二月
- 2023 年 十一月
- 2023 年 十月
- 2023 年 九月
- 2023 年 八月
- 2023 年 七月
- 2023 年 六月
- 2023 年 五月
- 2023 年 四月
- 2023 年 三月
- 2023 年 二月
- 2023 年 一月
- 2022 年 十二月
- 2022 年 十一月
- 2022 年 十月
- 2022 年 九月
- 2022 年 八月
- 2022 年 七月
- 2022 年 六月
- 2022 年 五月
- 2022 年 四月
- 2022 年 三月
- 2022 年 二月
- 2022 年 一月
- 2021 年 十二月
- 2021 年 十一月
- 2021 年 十月
- 2021 年 九月
- 2021 年 八月
- 2021 年 七月
- 2021 年 六月
- 2021 年 五月
- 2021 年 四月
- 2021 年 三月
- 2021 年 二月
- 2021 年 一月
- 2020 年 十二月
- 2020 年 十一月
- 2020 年 十月
- 2020 年 九月
- 2020 年 八月
- 2020 年 七月
- 2020 年 六月
- 2020 年 五月
- 2020 年 四月
- 2020 年 三月
- 2020 年 二月
- 2020 年 一月
- 2019 年 十二月
- 2019 年 十一月
- 2019 年 十月
- 2019 年 九月
- 2019 年 八月
- 2019 年 七月
- 2019 年 六月
- 2019 年 五月
- 2019 年 四月
- 2019 年 三月
- 2019 年 二月
- 2019 年 一月
- 2018 年 十二月
- 2018 年 十一月
- 2018 年 十月
- 2018 年 九月
- 2018 年 八月
其它
[無線路由器]雙WAN功能
[教學]如何去除手機App 以及網頁中的廣告|Adguard|Hosts Go
參考網址:https://www.youtube.com/watch?v=cTKwwHrwhRY
私人DNS dns.adguard.com
[windows]將 Windows 自動更新暫停到 2051 年 12 月 31 日 – Windows Update Killer
參考網址:將 Windows 自動更新暫停到 2051 年 12 月 31 日 – Windows Update Killer | UNIKO's Hardware
下載
Releases · Aetherinox/windows-update-killer
由於 Windows 10 和 Windows 11 家用版不提供關閉自動更新的功能,最多透過暫停更新去延長下次進行更新的時間,使用者只能依賴其他方式去避免更新。先前分享過 StopUpdates10 與 Windows Update Blocker 兩款自動更新關閉工具,考量到有些人不想使用第三方工具,因此分享國外網友製作的登錄檔,使用後可以暫停更新至 2051 年 12 月 31 日喔!
如果沒使用登錄檔,家用版最多暫停 5 週。
[excel]秩序冊出場序版面產生器
參考網址:李坦闊老師FB https://www.facebook.com/tancle.taiwan
下載點 http://bit.ly/3gjxD0S
使用教學 影片說明 https://youtu.be/Qj-HtxSDvM0
本系統是在Fb社團「Excel 函數教學 & 討論」發問,由「陳鴻儒」先生撰寫原始碼,「閃鈴教室」做些微修改後,無償提供大眾使用。
[php]php 8 How to solve this error? strlen(): Passing null to parameter #1 ($string) of type string is deprecated in
參考網址:question2answer
Before PHP 8.1:
echo strlen(null); // No deprecation notice is shown up. // -> 0
As of PHP 8.1:
echo strlen(null); // Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in ... on line ... // -> 0
Solution
The RFC describing this issue is really helpful for possible resolutions and I highly recommend reviewing it. As of Question2Answer, the official resolution was to make use of the Null Coalescing Operator (??) when possible; here is an example from GitHub, which replaces:
if (strlen($error )) {...}
with this:
if (strlen($error ?? '')) {...}
This effectively fixes the issue.
合併運算子(??)
php7開始支援
PHP 7 新特性二Null coalescing operator(空合并运算符)
空值合併運算子
如要相容於php5.6得改掉「??」
https://github.com/tad0616/tadnews/commit/master 修正PHP5.x會出錯的問題 $result['of_ncsn'][$ncsn] = $page['of_ncsn'] ?? $the_ncsn; $result['of_ncsn'][$ncsn] = isset($page['of_ncsn']) ? $page['of_ncsn'] : $the_ncsn;
[php][ajax]一個不錯的table界面
網路閒晃,意外發現。
Add advanced interaction controls to your HTML tables the free & easy way
[php]升級到PHP8之後的調整
參考網址:https://fannys23.pixnet.net/blog/post/48239316
配合 PHP 8 停止支援 __autoload(),改用 sql_autoloaod_register()
配合 PHP 8 停用 each(),改用 foreach()
錯誤訊息:PHP Fatal error: Uncaught Error: Call to undefined function each()
while(list(, $line) = @each($lines)) {
改寫為:
foreach ($lines as $line) {
在 PHP 8 要對 PHPExcel 做的調整:
-
陣列元素不可再使用大括號 {} 操作,需要使用中括號 []
- 錯誤訊息:PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported
-
原本在 PHP 7 的寫法為:
$str = array(1, 2, 3);
$test = $str{0};
改寫為:
$str = array(1, 2, 3);
$test = $str[0];
-
在 DefaultValueBinder.php 出現 "Trying to access array offset on value of type int",依照 stackoverflow 的上的討論,我將第 86 行由:
} elseif ($pValue[0] === '=' && strlen($pValue) > 1) {
改為:
} elseif (0 === strpos($pValue, '=') && strlen($pValue) > 1) {
https://forum.gamer.com.tw/C.php?bsn=60292&snA=8686
解決count()的錯誤
原本在PHP7能運行的count()程式段,在PHP8會報error
Exception: count(): Argument #1 ($value) must be of type Countable|array, null given
報錯原因
因為count()在PHP8需要是array或是countable,否則會報TypeError
在PHP7時期只會跳warning
https://www.php.net/manual/en/function.count.php
解決方案
第一種:先作宣告
於第425行後加上以下兩條
$new_Timestamp = [];
$new_TimestampTitle = [];
第二種:加上is_countable()
將434的if(count($new_TimestampTitle)>0){
改為if (is_countable($new_TimestampTitle) && count($new_TimestampTitle) > 0) {
調整sport/ns到php8.1.2(ubuntu 22.04預設php版本)
adodb升級至v5.22.7 include/config.php 修正 //Smarty 偵錯 define('DEBUG' , 'false') ; 比較麻煩的是這個錯誤 Fatal error: Uncaught Error: Undefined constant "play_group_level_id" in /var/www/html/ns/sum/sum_item.php:20 Stack trace: #0 {main} thrown in /var/www/html/ns/sum/sum_item.php on line 20 陣列的索引值如果是文字則必需有''包住,之前的版本只是會提出警告,php8直接給Fatal error 例如:$sys_conf[play_place] 必需改為$sys_conf['play_place'] 用sublime text正則表示式找陣列,以「$」開頭,以「[」結束的字串 \$(\w+)\[ \w matches any word character (equivalent to [a-zA-Z0-9_]) \$(\w+)\[(\w+)]
[php]PhpSpreadsheet 相關文件
PHPExcel套件最後一版是2015年寫的,目前已不再更新。
https://github.com/PHPOffice/PHPExcel
為了因應越來越複雜的Excel版本,得找找有沒有可以替代的套件。
這是PHPExcel的後續套件PHPSpreadSheet
https://github.com/PHPOffice/PhpSpreadsheet/
徐嘉裕(Neil Hsu)的工作心得網誌!
唯一比較麻煩的是使用PhpSpreadsheet要先佈署composer,如果沒佈署composer是沒辦法使用的,還好官方有釋出已經設定好的phpoffice套件可以直接引入使用,省了很多麻煩
https://neohsuxoops.blogspot.com/2020/09/phpspreadsheetphpexcel-xoops.html
PhpSpreadsheet套件下載
https://drive.google.com/file/d/1jw73diWVjbcr1ycY-gtqM2cGfpLp1zS_/view?usp=sharing
下載回來後解壓縮把phpoffice跟PhpSpreadsheet丟到class資料夾中,未來如需更新PhpSpreadsheet可到官網下載最新版覆蓋即可
使用說明https://phpspreadsheet.readthedocs.io/en/latest/
read 範例(php 7.4)( 在php5.6測試有問題)
<?php include_once 'class/phpoffice/vendor/autoload.php'; use PhpOffice\PhpSpreadsheet\IOFactory; //require __DIR__ . '/../Header.php'; //$inputFileName = __DIR__ . '/sampleData/example1.xls'; //$inputFileName = __DIR__ . '/good-example.xlsx'; $inputFileName = __DIR__ . '/1103289.xls'; //$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory to identify the format'); $spreadsheet = IOFactory::load($inputFileName); $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); //$helper->displayGrid($sheetData); print_r($sheetData);
[hyper-v]Win11 家用版如何安裝 Hyper-V虛擬機
參考網址:https://kkplay3c.net/windows-installs-hyperv/
win11 家用版是不支援hyper-v的,得自己裝。
pushd "%~dp0" dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i" del hyper-v.txt Dism /online /enable-feature /featurename:Microsoft-Hyper-V-All /LimitAccess /ALL
存成cmd,以系統管理員身分執行。
裝好後執行Hyper-v管理員
相關功能:開啟或關閉Windows功能