<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      xml:lang="zh-tw">
<title>豬窩</title> 
<link rel="alternate" type="text/html" href="http://120.112.17.17/blog/shyong" /> 
	 
	<updated>2022-11-10T17:32:15+08:00</updated> 
<generator>lifetype-1.2.10_r6971</generator> 
<id>http://120.112.17.17/blog/rss.php?blogId=2&amp;profile=atom</id>
 
<rights>Copyright (c) shyong</rights> 
  
 <entry> 
 <id>tag:120.112.17.17,2022-11-10:600</id>
 <title>win10 連 samba 網路芳鄰</title> 
 <link rel="alternate" type="text/html" href="http://120.112.17.17/blog/shyong/archives/600" /> 
  
 <updated>2022-11-10T17:32:15+08:00</updated> 
 <summary type="text"> 
明明我的samba是3版也不可以,只好打開 windows 的 samv1,
 
 
開啟或關閉 Windows 功能，找到 SMB 1.0 相關的選項，啟用  SMB 1.0/CIFS 用戶端  及  SMB 1.0/CIFS ...</summary> 
 <author> 
  
 <name>shyong</name> 
</author> 
<dc:subject>
Windows 
</dc:subject> 
 <content type="text" xml:lang="zh-tw" xml:base="http://120.112.17.17/blog/shyong"> 
  
明明我的samba是3版也不可以,只好打開 windows 的 samv1,
 
 
開啟或關閉 Windows 功能，找到 SMB 1.0 相關的選項，啟用  SMB 1.0/CIFS 用戶端  及  SMB 1.0/CIFS   自動移 ，伺服器沒用到就不要勾選,net use s: \\ip\dir /user:name password 就有 S
 
 
參考: https://helloworld.pixnet.net/blog/post/46536909-%E8%A7%A3%E6%B1%BA-windows-10-%E7%84%A1%E6%B3%95%E9%80%A3%E7%B7%9A-smb1-%E5%95%8F%E9%A1%8C  
  
</content> 
</entry> 
 
 <entry> 
 <id>tag:120.112.17.17,2021-06-20:599</id>
 <title>php 驗證碼 imgage 圖像函數,font 路徑</title> 
 <link rel="alternate" type="text/html" href="http://120.112.17.17/blog/shyong/archives/599" /> 
  
 <updated>2021-06-20T12:42:27+08:00</updated> 
 <summary type="text"> 
在驗證碼使用 imaettftext 時,  imagettftext ( resource 
image, float size, float angle, int x, int y, int color, string 
fontfile, string text ),fontfile 可能因為 ...</summary> 
 <author> 
  
 <name>shyong</name> 
</author> 
<dc:subject>
PHP, JavaScript, Sql 
</dc:subject> 
 <content type="text" xml:lang="zh-tw" xml:base="http://120.112.17.17/blog/shyong"> 
  
在驗證碼使用 imaettftext 時,  imagettftext ( resource 
image, float size, float angle, int x, int y, int color, string 
fontfile, string text ),fontfile 可能因為 
GD版本不同,查找目錄的方式可能不同,因此找不到字型檔,在檔案前加入路徑,如:$font = './symbol.ttf';加入 ./ 
強迫查找當前目錄就可以
  
</content> 
</entry> 
 
 <entry> 
 <id>tag:120.112.17.17,2021-04-11:598</id>
 <title>Barcode/NFC/OCR Scanner Keyboard 手機網頁輸入掃瞄</title> 
 <link rel="alternate" type="text/html" href="http://120.112.17.17/blog/shyong/archives/598" /> 
  
 <updated>2021-04-11T17:24:44+08:00</updated> 
 <summary type="text"> 
Barcode/NFC/OCR Scanner Keyboard 手機網頁輸入掃瞄
 
 
也就是用手機登入網頁,在文字輸入欄位可以用手機掃瞄條碼的功能 
 </summary> 
 <author> 
  
 <name>shyong</name> 
</author> 
<dc:subject>
學校網頁 
</dc:subject> 
 <content type="text" xml:lang="zh-tw" xml:base="http://120.112.17.17/blog/shyong"> 
  
Barcode/NFC/OCR Scanner Keyboard 手機網頁輸入掃瞄
 
 
也就是用手機登入網頁,在文字輸入欄位可以用手機掃瞄條碼的功能 
  
</content> 
</entry> 
 
 <entry> 
 <id>tag:120.112.17.17,2020-11-08:597</id>
 <title>驗證碼重新讀取</title> 
 <link rel="alternate" type="text/html" href="http://120.112.17.17/blog/shyong/archives/597" /> 
  
 <updated>2020-11-08T21:41:16+08:00</updated> 
 <summary type="text"> 
今天在玩網頁登入加入驗證碼,可是在重新讀取時一直沒有作用,後來查網才知道,因為 src 沒有改變,所以不會重新執行
 
原來 img 的 jquery ...</summary> 
 <author> 
  
 <name>shyong</name> 
</author> 
<dc:subject>
PHP, JavaScript, Sql 
</dc:subject> 
 <content type="text" xml:lang="zh-tw" xml:base="http://120.112.17.17/blog/shyong"> 
  
今天在玩網頁登入加入驗證碼,可是在重新讀取時一直沒有作用,後來查網才知道,因為 src 沒有改變,所以不會重新執行
 
原來 img 的 jquery
 
$(&quot;#getcode_num&quot;).click(function(){ 
&nbsp;&nbsp; &nbsp;$(this).prop(&quot;src&quot;, &quot;captcha/code_num.php&quot; ); }) &nbsp;
 
//沒有作用,因為 src =&nbsp; &quot;captcha/code_num.php&quot; 永遠一樣.,不會改變
 
改成
 
$(&quot;#getcode_num&quot;).click(function(){ 
&nbsp;&nbsp; &nbsp;$(this).prop(&quot;src&quot;, &quot;captcha/code_num.php?code=&quot; + Math.random());&nbsp;&nbsp; });&nbsp;&nbsp;
 
//改變,因為 src = &quot;captcha/code_num.php?code=&quot; + Math.random()); 因為 random每次改不一樣的值,code 參數隻是讓 src 不一樣,在後端不用處理
 
 
&nbsp;
  
</content> 
</entry> 
 
 <entry> 
 <id>tag:120.112.17.17,2020-09-10:596</id>
 <title>php mysqli_multi_query 執行多筆 sql 指令 -- update 多筆用</title> 
 <link rel="alternate" type="text/html" href="http://120.112.17.17/blog/shyong/archives/596" /> 
  
 <updated>2020-09-10T21:14:44+08:00</updated> 
 <summary type="text"> 
在 update 不同值時, mysqli_query 只能一筆一筆更新,時間效率都很差,上網找的方法是產生一個更新資料暫存表,再用唯一值一次更新. ...</summary> 
 <author> 
  
 <name>shyong</name> 
</author> 
<dc:subject>
PHP, JavaScript, Sql 
</dc:subject> 
 <content type="text" xml:lang="zh-tw" xml:base="http://120.112.17.17/blog/shyong"> 
  
在 update 不同值時, mysqli_query 只能一筆一筆更新,時間效率都很差,上網找的方法是產生一個更新資料暫存表,再用唯一值一次更新.
 
 
經過重覆測試,指令如下:&nbsp; 
 
 

 
 
$sql1 = &quot;CREATE TABLE IF NOT EXISTS `std_pnum` (&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  //產生暫存,最後沒有刪除,想說都要用  
&nbsp; `stdno` varchar(10) NOT NULL, 
&nbsp; `subjno` text NOT NULL, 
&nbsp; `class` varchar(6) DEFAULT NULL, 
&nbsp; `grade` varchar(8) DEFAULT NULL, 
&nbsp; `seme` varchar(6) DEFAULT NULL, 
&nbsp; `pnum` smallint(6) DEFAULT NULL 
) ENGINE=InnoDB DEFAULT CHARSET=utf8;&quot;; 
 
 
$sql1 .= &quot;delete from std_pnum ;&quot;;&nbsp;&nbsp;&nbsp;  //一開始先清空 tmp表   
$sql1 .= &quot;set @count := $bnum ; &quot;;&nbsp;  //設定開始更新值,由 php 代入 
,宣告變數要用 set 或 select ,不可用 declare (在有 begin - end 內才可以用,一開始用 Declare 在這裡卡好久)&nbsp; 
 
 
 //用現有資料,利用 stdno 當唯一值,相同同編號,因為 @count := @count + 1 會跟來源變動,所以用子查詢我方式,將來源先轉成單純的唯一值排序,這樣@count 才會正常累加 
 
 
&nbsp;&nbsp;&nbsp; $sql2 = &quot;insert into std_pnum  
&nbsp;&nbsp; &nbsp;select c.stdno,c.subjno,c.class,c.grade,c.seme, @count := @count + 1 from  
&nbsp;&nbsp; &nbsp;(select a.* from pig_reopen_std a LEFT JOIN student b ON a.stdno = b.stdno  
&nbsp;&nbsp; &nbsp;WHERE a.indate &gt;= '{$config['okdate']}' AND 
a.syear={$config['syear']} AND ((a.delete_yn&lt;&gt;'Y') Or (a.delete_yn
Is Null)) AND a.pnum &lt;= 0  
&nbsp;&nbsp; &nbsp;group by a.stdno  
&nbsp;&nbsp; &nbsp;ORDER BY b.classno,b.seat,a.stdno,a.subjno,a.class,a.grade,a.seme) c ; &quot;;&nbsp;&nbsp;&nbsp; 
 
 
 //直接用產生的暫存表更新  
&nbsp;&nbsp; &nbsp;$sql3 = &quot;update pig_reopen_std a ,std_pnum b set a.pnum=b.pnum where a.stdno = b.stdno ;&quot;; 
&nbsp;&nbsp; &nbsp;$sql = $sql1 . $sql2 . $sql3 ; 
 
 
&nbsp;&nbsp; if (mysqli_multi_query($link, $sql)) {&nbsp;&nbsp;&nbsp;  //執行sql   
&nbsp;&nbsp; do { 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mysqli_free_result($result); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (mysqli_more_results($link)) 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$up_num = mysqli_affected_rows ( $link );&nbsp;  //取得最後更新筆數  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } 
&nbsp;&nbsp;&nbsp; } while (mysqli_next_result($link)); 
&nbsp;&nbsp;&nbsp;}
 
&nbsp;&nbsp; &nbsp;
 
 
本來更新350筆要14秒,現在馬上完成,顯示0秒 
  
</content> 
</entry> 
 
 <entry> 
 <id>tag:120.112.17.17,2020-08-25:595</id>
 <title>新重修科目多年級學期設定</title> 
 <link rel="alternate" type="text/html" href="http://120.112.17.17/blog/shyong/archives/595" /> 
  
 <updated>2020-08-25T10:45:17+08:00</updated> 
 <summary type="text"> 
範例檔: 108.xls 
 
說明檔: subject.docx </summary> 
 <author> 
  
 <name>shyong</name> 
</author> 
<dc:subject>
學校網頁 
</dc:subject> 
 <content type="text" xml:lang="zh-tw" xml:base="http://120.112.17.17/blog/shyong"> 
  
範例檔: 108.xls 
 
說明檔: subject.docx  
</content> 
</entry> 
 
 <entry> 
 <id>tag:120.112.17.17,2020-08-12:594</id>
 <title>mysql 插入數據時出現 Incorrect string value: &#039;\xF0\x9F...&#039; for column &#039;name&#039; at row 1的異常</title> 
 <link rel="alternate" type="text/html" href="http://120.112.17.17/blog/shyong/archives/594" /> 
  
 <updated>2020-08-12T17:31:35+08:00</updated> 
 <summary type="text"> 
最近在用 Excel 檔匯入資料時,顯示 Error , 轉成 Csv 再匯入就正常, 查網,原來是有些 Utf8 圖型或造字用到 
4碼(含)以上,而 Mysql 的 Utf8 ...</summary> 
 <author> 
  
 <name>shyong</name> 
</author> 
<dc:subject>
PHP, JavaScript, Sql 
</dc:subject> 
 <content type="text" xml:lang="zh-tw" xml:base="http://120.112.17.17/blog/shyong"> 
  
最近在用 Excel 檔匯入資料時,顯示 Error , 轉成 Csv 再匯入就正常, 查網,原來是有些 Utf8 圖型或造字用到 
4碼(含)以上,而 Mysql 的 Utf8 內定3碼,解決方法網上是將內定 Utf8 3碼改成 
character-set-server=utf8mb4 
4碼,資料表也要更改(https://blog.csdn.net/m0_37983376/article/details/79224862)有修改方法,可是我改後無效,不知少了什麼,後來想,那些造字沒有顯示對網頁來說沒有那麼重要,所以想到一個取巧的方式,將這些字丟掉不存在就可以了,方法是,在
php 程式,將 utf8 轉成 big5 ,那些字就會用 &quot;?&quot; 代替,再將它轉回 Utf8 給網頁用,再樣那些字就給轉不見了, Csv 
不用轉,因為它本來就是 big5,程式自動轉成 Utf8 ,指令如下:
 
 
if($type != &quot;csv&quot;)&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //不是csv檔,$str 轉big5再轉回Utf-8,排除 utf8 4碼以上字及造字,mysql utf8 內定三碼&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $str5 = mb_convert_encoding($str, &quot;big5&quot; , &quot;UTF-8&quot;); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $str = mb_convert_encoding($str5, &quot;UTF-8&quot;, &quot;big5&quot;); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } 
  
</content> 
</entry> 
 
 <entry> 
 <id>tag:120.112.17.17,2020-08-02:593</id>
 <title>貼上 Excel 時,前方有零文字,會變數字,零會不見</title> 
 <link rel="alternate" type="text/html" href="http://120.112.17.17/blog/shyong/archives/593" /> 
  
 <updated>2020-08-02T17:43:38+08:00</updated> 
 <summary type="text"> 
因為 Excel 會將都是數字的文字貼上時當數字格式處理,如果要保留文字格式,我使用方法如下(不知有沒有更好)
 
 
將要貼上的 Excel ...</summary> 
 <author> 
  
 <name>shyong</name> 
</author> 
<dc:subject>
Windows 
</dc:subject> 
 <content type="text" xml:lang="zh-tw" xml:base="http://120.112.17.17/blog/shyong"> 
  
因為 Excel 會將都是數字的文字貼上時當數字格式處理,如果要保留文字格式,我使用方法如下(不知有沒有更好)
 
 
將要貼上的 Excel 儲存格改成文字格式,再貼上時先按右鍵,選擇右邊圖式(符合目的格式設定)就可以保留零,因為我們已經先將格式改成文字
 
 
說明檔 :  Excel.docx  
  
</content> 
</entry> 
 
 <entry> 
 <id>tag:120.112.17.17,2020-07-22:592</id>
 <title>phpexcel中PHPExcel_Exception Invalid cell coordinate</title> 
 <link rel="alternate" type="text/html" href="http://120.112.17.17/blog/shyong/archives/592" /> 
  
 <updated>2020-07-22T22:55:14+08:00</updated> 
 <summary type="text"> 
那是欄位超出 26 的原因,Excel A1.B1.......Z1,AA1,AB1...所以輸出的時侯要轉換, Google 
看到直接在程式轉換,覺的不好用,自己寫一個小函數,代入 row 從 0 ...</summary> 
 <author> 
  
 <name>shyong</name> 
</author> 
<dc:subject>
PHP, JavaScript, Sql 
</dc:subject> 
 <content type="text" xml:lang="zh-tw" xml:base="http://120.112.17.17/blog/shyong"> 
  
那是欄位超出 26 的原因,Excel A1.B1.......Z1,AA1,AB1...所以輸出的時侯要轉換, Google 
看到直接在程式轉換,覺的不好用,自己寫一個小函數,代入 row 從 0 開始,直接轉換 
A,B,C.....AA,AB,AC........ZX,ZY,ZZ ,應該足夠用
 
 
function n2a($num) 
{ 
&nbsp;&nbsp;&nbsp; $b = 26;&nbsp;&nbsp;&nbsp; //除數,26個英文字母 
&nbsp;&nbsp;&nbsp; $c = 64;&nbsp;&nbsp;&nbsp; //商+64 ,第二位英文字 
&nbsp;&nbsp;&nbsp; $d = 65;&nbsp;&nbsp;&nbsp; //餘數+ 65 , 餘數字母 
&nbsp;&nbsp;&nbsp; $aa =(int)($num / $b) ;&nbsp; //有無超過 26 
&nbsp;&nbsp;&nbsp; $bb = $num % $b ;&nbsp; //餘數 
&nbsp;&nbsp;&nbsp; $ret = ($aa) ? chr($aa+$c).chr($bb+$d) : chr($bb+$d) ;&nbsp;&nbsp;&nbsp;&nbsp;
 
 
&nbsp;&nbsp;&nbsp; return $ret; 
} 
  
</content> 
</entry> 
 
 <entry> 
 <id>tag:120.112.17.17,2020-07-07:591</id>
 <title>javascript 不同型態比較不相等</title> 
 <link rel="alternate" type="text/html" href="http://120.112.17.17/blog/shyong/archives/591" /> 
  
 <updated>2020-07-07T20:46:41+08:00</updated> 
 <summary type="text"> 
在取部份字串時, 用 substr 取是 String&amp;nbsp; ,match 取是 Object ,直接 if(substr == match) 傳回 False 必須改字串才能比較,如下: ...</summary> 
 <author> 
  
 <name>shyong</name> 
</author> 
<dc:subject>
PHP, JavaScript, Sql 
</dc:subject> 
 <content type="text" xml:lang="zh-tw" xml:base="http://120.112.17.17/blog/shyong"> 
  
在取部份字串時, 用 substr 取是 String&nbsp; ,match 取是 Object ,直接 if(substr == match) 傳回 False 必須改字串才能比較,如下:
 
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var str = 'c002'; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mstr = str.match(/\d+/). toString() ; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sstr = str.substr( 1 , 3 ). toString() ; 
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; alert(mstr + &quot; = &quot; + typeof(mstr) + &quot;\n&quot; + sstr + &quot; = &quot; + typeof(sstr)); 
  
</content> 
</entry> 
 
</feed>