<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>เทคนิคการเขียนเว็บ เขียนโปรแกรม php คัดมา เน้น ๆ : webshowpow.com &#187; ทิปการเขียน</title>
	<atom:link href="http://www.webshowpow.com/category/%e0%b8%97%e0%b8%b4%e0%b8%9b%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%80%e0%b8%82%e0%b8%b5%e0%b8%a2%e0%b8%99/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webshowpow.com</link>
	<description>เทคนิคการเขียนเว็บ เขียนโปรแกรม php คัดมา เน้น ๆ</description>
	<lastBuildDate>Mon, 23 Aug 2010 11:59:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ข้อแตกต่างของ ประกาศตัวแปร และ define</title>
		<link>http://www.webshowpow.com/%e0%b8%9b%e0%b8%a3%e0%b8%b0%e0%b8%81%e0%b8%b2%e0%b8%a8-%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%81%e0%b8%9b%e0%b8%a3-define/</link>
		<comments>http://www.webshowpow.com/%e0%b8%9b%e0%b8%a3%e0%b8%b0%e0%b8%81%e0%b8%b2%e0%b8%a8-%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%81%e0%b8%9b%e0%b8%a3-define/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 10:54:40 +0000</pubDate>
		<dc:creator>เลนส์เว้า</dc:creator>
				<category><![CDATA[ทิปการเขียน]]></category>
		<category><![CDATA[2]]></category>
		<category><![CDATA[define]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[งาน]]></category>
		<category><![CDATA[ตัวแปร]]></category>
		<category><![CDATA[ประกาศ]]></category>
		<category><![CDATA[ผลลัพธ์]]></category>
		<category><![CDATA[ลักษณะ]]></category>
		<category><![CDATA[วิธี]]></category>
		<category><![CDATA[แตกต่าง]]></category>

		<guid isPermaLink="false">http://www.webshowpow.com/?p=241</guid>
		<description><![CDATA[ไม่ว่าจะ้เป็น
การประกาศตัวแปร -> $startpage = &#8220;1&#8243;;
หรือ การใช้ function define -> define(&#8221;startpage&#8221;,&#8221;1&#8243;);
แต่ก็ได้ค่าออกมา เป็นค่าเดียวกันคือ 1 
แต่ของแตกต่างของ 2 วิธีนี้ก็คือ

1
2
3
$startpage = &#34;1&#34;;
$startpage = &#34;2&#34;;
echo  $startpage;  // ได้ผลลัพธ์คือ 2

&#160;

1
2
3
define&#40;&#34;startpage&#34;,&#34;1&#34;&#41;;
define&#40;&#34;startpage&#34;,&#34;2&#34;&#41;;
echo  startpage;  // ได้ผลลัพธ์คือ 1

&#160;
หวังว่าคงเข้าใจกันนะครับ
&#160;
เวลาใช้งานก็ดูลักษณะงานด้วยนะครับ  
&#160;
]]></description>
			<content:encoded><![CDATA[<p>ไม่ว่าจะ้เป็น<br />
การประกาศตัวแปร -> $startpage = &#8220;1&#8243;;<br />
หรือ การใช้ function define -> define(&#8221;startpage&#8221;,&#8221;1&#8243;);</p>
<p>แต่ก็ได้ค่าออกมา เป็นค่าเดียวกันคือ 1 </p>
<p>แต่ของแตกต่างของ 2 วิธีนี้ก็คือ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$startpage</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$startpage</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;2&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span>  <span style="color: #000088;">$startpage</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// ได้ผลลัพธ์คือ 2</span></pre></td></tr></table></div>

<p>&nbsp;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;startpage&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;startpage&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span>  startpage<span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// ได้ผลลัพธ์คือ 1</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>หวังว่าคงเข้าใจกันนะครับ</p>
<p>&nbsp;</p>
<blockquote><p>เวลาใช้งานก็ดูลักษณะงานด้วยนะครับ <img src='http://www.webshowpow.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p></blockquote>
<p>&nbsp;</p>
<img src="http://www.webshowpow.com/?ak_action=api_record_view&id=241&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.webshowpow.com/%e0%b8%9b%e0%b8%a3%e0%b8%b0%e0%b8%81%e0%b8%b2%e0%b8%a8-%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%81%e0%b8%9b%e0%b8%a3-define/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>function แปลง tis620 เป็น utf8</title>
		<link>http://www.webshowpow.com/%e0%b9%81%e0%b8%9b%e0%b8%a5%e0%b8%87-tis620-%e0%b9%80%e0%b8%9b%e0%b9%87%e0%b8%99-utf8/</link>
		<comments>http://www.webshowpow.com/%e0%b9%81%e0%b8%9b%e0%b8%a5%e0%b8%87-tis620-%e0%b9%80%e0%b8%9b%e0%b9%87%e0%b8%99-utf8/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 10:43:58 +0000</pubDate>
		<dc:creator>เลนส์เว้า</dc:creator>
				<category><![CDATA[ทิปการเขียน]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[tis620]]></category>
		<category><![CDATA[unicode]]></category>
		<category><![CDATA[utf8]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[สามารถ]]></category>
		<category><![CDATA[เปลี่ยน]]></category>
		<category><![CDATA[แปลง]]></category>
		<category><![CDATA[ไม่]]></category>

		<guid isPermaLink="false">http://www.webshowpow.com/?p=240</guid>
		<description><![CDATA[ในการเขียนเวปไซด์บ้างครั้งเรามีความจำเป็นที่จะต้องแปลง unicode
ไปมาระหว่าง tis620 เป็น utf8 หรือจาก utf8 เป็น tis620
ผมขอยกตัวอย่างเคสที่ต้องเปลี่ยน unicode
เช่น db เป็น tis620 แต่หน้าเวปไซด์เรา เป็น utf8
และเราไม่สามารถที่จะเ้ปลี่ยนจาก db เป็น utf8
และเราก็ไม่สามารถเปลี่ยนเวปไซด์เป็น tis620 ได้
เราต้องใช้ function ดังกล่าวเปลี่ยน unicode ครับ
function ในการแปลงจาก tis620 เป็น utf8

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function tis620_to_utf8&#40;$tis&#41; &#123;
  for&#40; $i=0 ; $i&#60; strlen&#40;$tis&#41; ; $i++ &#41;&#123;
    $s = substr&#40;$tis, $i, 1&#41;;
    $val = ord&#40;$s&#41;;
  [...]]]></description>
			<content:encoded><![CDATA[<p>ในการเขียนเวปไซด์บ้างครั้งเรามีความจำเป็นที่จะต้องแปลง unicode<br />
ไปมาระหว่าง tis620 เป็น utf8 หรือจาก utf8 เป็น tis620<br />
ผมขอยกตัวอย่างเคสที่ต้องเปลี่ยน unicode<br />
เช่น db เป็น tis620 แต่หน้าเวปไซด์เรา เป็น utf8<br />
และเราไม่สามารถที่จะเ้ปลี่ยนจาก db เป็น utf8<br />
และเราก็ไม่สามารถเปลี่ยนเวปไซด์เป็น tis620 ได้<br />
เราต้องใช้ function ดังกล่าวเปลี่ยน unicode ครับ</p>
<p><strong>function ในการแปลงจาก tis620 เป็น utf8</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> tis620_to_utf8<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tis</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tis</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tis</span><span style="color: #339933;">,</span> <span style="color: #000088;">$i</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$val</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ord</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$val</span> <span style="color: #339933;">&lt;</span> <span style="color: #208080;">0x80</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	 <span style="color: #000088;">$utf8</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$s</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #208080;">0xA1</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$val</span> and <span style="color: #000088;">$val</span> <span style="color: #339933;">&lt;=</span> <span style="color: #208080;">0xDA</span><span style="color: #009900;">&#41;</span> 
              or <span style="color: #009900;">&#40;</span><span style="color: #208080;">0xDF</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$val</span> and <span style="color: #000088;">$val</span> <span style="color: #339933;">&lt;=</span> <span style="color: #208080;">0xFB</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span>
	 <span style="color: #000088;">$unicode</span> <span style="color: #339933;">=</span> <span style="color: #208080;">0x0E00</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$val</span> <span style="color: #339933;">-</span> <span style="color: #208080;">0xA0</span><span style="color: #339933;">;</span>
	 <span style="color: #000088;">$utf8</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span> <span style="color: #208080;">0xE0</span> <span style="color: #339933;">|</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$unicode</span> <span style="color: #339933;">&gt;&gt;</span> <span style="color: #cc66cc;">12</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	 <span style="color: #000088;">$utf8</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span> <span style="color: #208080;">0x80</span> <span style="color: #339933;">|</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$unicode</span> <span style="color: #339933;">&gt;&gt;</span> <span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0x3F</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	 <span style="color: #000088;">$utf8</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span> <span style="color: #208080;">0x80</span> <span style="color: #339933;">|</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$unicode</span> <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0x3F</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$utf8</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>function ในการแปลงจาก utf8 เป็น tis620</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> utf8_to_tis620<span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$str</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$string</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$res</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">ord</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">224</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	  <span style="color: #000088;">$unicode</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ord</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0x3F</span><span style="color: #339933;">;</span>
	  <span style="color: #000088;">$unicode</span> <span style="color: #339933;">|=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">ord</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0x3F</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;&lt;</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">;</span>
	  <span style="color: #000088;">$unicode</span> <span style="color: #339933;">|=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">ord</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0x0F</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;&lt;</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span>
	  <span style="color: #000088;">$res</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$unicode</span><span style="color: #339933;">-</span><span style="color: #208080;">0x0E00</span><span style="color: #339933;">+</span><span style="color: #208080;">0xA0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	  <span style="color: #000088;">$i</span> <span style="color: #339933;">+=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	  <span style="color: #000088;">$res</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$str</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$res</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<img src="http://www.webshowpow.com/?ak_action=api_record_view&id=240&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.webshowpow.com/%e0%b9%81%e0%b8%9b%e0%b8%a5%e0%b8%87-tis620-%e0%b9%80%e0%b8%9b%e0%b9%87%e0%b8%99-utf8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>เซตเวลาในการติดต่อกับเวปอื่น</title>
		<link>http://www.webshowpow.com/%e0%b9%80%e0%b8%8b%e0%b8%95%e0%b9%80%e0%b8%a7%e0%b8%a5%e0%b8%b2%e0%b9%83%e0%b8%99%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b9%88%e0%b8%ad%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b9%80%e0%b8%a7%e0%b8%9b/</link>
		<comments>http://www.webshowpow.com/%e0%b9%80%e0%b8%8b%e0%b8%95%e0%b9%80%e0%b8%a7%e0%b8%a5%e0%b8%b2%e0%b9%83%e0%b8%99%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b9%88%e0%b8%ad%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b9%80%e0%b8%a7%e0%b8%9b/#comments</comments>
		<pubDate>Tue, 04 May 2010 07:46:05 +0000</pubDate>
		<dc:creator>เลนส์เว้า</dc:creator>
				<category><![CDATA[ทิปการเขียน]]></category>
		<category><![CDATA[default_socket_timeout]]></category>
		<category><![CDATA[file_get_contents]]></category>
		<category><![CDATA[fopen]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[ini_set]]></category>
		<category><![CDATA[ข้อมูล]]></category>
		<category><![CDATA[จำเป็น]]></category>
		<category><![CDATA[ล่ม]]></category>
		<category><![CDATA[เซต]]></category>
		<category><![CDATA[เวลา]]></category>
		<category><![CDATA[แสดงผล]]></category>

		<guid isPermaLink="false">http://www.webshowpow.com/?p=237</guid>
		<description><![CDATA[ในการเขียนเวปไซด์ บ้างครั้งเรามีความเป็นที่จะต้องนำข้อมูลของที่อื่น
มาแสดงในเวปของเรา โดยที่ไม่ใช่แบบ iframe แต่ใช้ ฟังก์ชั่น
ของ php เช่น fopen() หรือ file_get_contents()
ซึ่งวิธีนี้ ข้อดีคือ เราสามารถกำหนดรูปแบบในการแสดงผลได้
แต่ข้อเสียคือ ถ้าเวปที่เราไปเอาข้อมูลมาไม่สามารถเข้าได้
หรือพูดง่ายๆ คือ เวปล่ม และจะทำให้เวปเราล่มไปด้วย
แต่มีวิธีแก้ไข คือเราจะต้องไปกำหนเวลาในการติดต่อ
ถ้าหมดเวลาตามที่เรากำหนดก็ให้ยกเลิกการติดต่อ 
โดยใช้คำสั่งนี้

1
ini_set&#40;'default_socket_timeout',$time&#41;

โดยที่
$time= เวลาที่ใช้ในการให้ติดต่อ หน่วยเป็น วินาที
ปล. ขอแนะนำว่าหลังจากใช้ ฟังก์ชั่นนี้แล้วให้เซตค่ากลับด้วย
ซึ่งค่าปกติคือ 60 วินาที
&#160;
วิธีแนะนำโดย โอ@WLS
]]></description>
			<content:encoded><![CDATA[<p>ในการเขียนเวปไซด์ บ้างครั้งเรามีความเป็นที่จะต้องนำข้อมูลของที่อื่น<br />
มาแสดงในเวปของเรา โดยที่ไม่ใช่แบบ iframe แต่ใช้ ฟังก์ชั่น<br />
ของ php เช่น fopen() หรือ file_get_contents()<br />
ซึ่งวิธีนี้ ข้อดีคือ เราสามารถกำหนดรูปแบบในการแสดงผลได้<br />
แต่ข้อเสียคือ ถ้าเวปที่เราไปเอาข้อมูลมาไม่สามารถเข้าได้<br />
หรือพูดง่ายๆ คือ เวปล่ม และจะทำให้เวปเราล่มไปด้วย</p>
<p>แต่มีวิธีแก้ไข คือเราจะต้องไปกำหนเวลาในการติดต่อ<br />
ถ้าหมดเวลาตามที่เรากำหนดก็ให้ยกเลิกการติดต่อ </p>
<p>โดยใช้คำสั่งนี้</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">ini_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'default_socket_timeout'</span><span style="color: #339933;">,</span><span style="color: #000088;">$time</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>โดยที่<br />
$time= เวลาที่ใช้ในการให้ติดต่อ หน่วยเป็น วินาที</p>
<p>ปล. ขอแนะนำว่าหลังจากใช้ ฟังก์ชั่นนี้แล้วให้เซตค่ากลับด้วย<br />
ซึ่งค่าปกติคือ 60 วินาที</p>
<p>&nbsp;</p>
<p>วิธีแนะนำโดย โอ@WLS</p>
<img src="http://www.webshowpow.com/?ak_action=api_record_view&id=237&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.webshowpow.com/%e0%b9%80%e0%b8%8b%e0%b8%95%e0%b9%80%e0%b8%a7%e0%b8%a5%e0%b8%b2%e0%b9%83%e0%b8%99%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%95%e0%b9%88%e0%b8%ad%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b9%80%e0%b8%a7%e0%b8%9b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>javascipt กับ cookie</title>
		<link>http://www.webshowpow.com/javascipt-%e0%b8%81%e0%b8%b1%e0%b8%9a-cookie/</link>
		<comments>http://www.webshowpow.com/javascipt-%e0%b8%81%e0%b8%b1%e0%b8%9a-cookie/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 10:04:37 +0000</pubDate>
		<dc:creator>เลนส์เว้า</dc:creator>
				<category><![CDATA[ทิปการเขียน]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[expires]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[ใช้งาน.time]]></category>

		<guid isPermaLink="false">http://www.webshowpow.com/?p=235</guid>
		<description><![CDATA[การ set cookie ให้ใช้งานได้โดยใช้ javascript สามารถทำได้โดย
ใช้ function นี้

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function createCookie&#40;name,value,days&#41; &#123;
	if &#40;days&#41; &#123;
		var date = new Date&#40;&#41;;
		date.setTime&#40;date.getTime&#40;&#41;+&#40;days*24*60*60*1000&#41;&#41;;
		var expires = &#34;; expires=&#34;+date.toGMTString&#40;&#41;;
	&#125;
	else var expires = &#34;&#34;;
	document.cookie = name+&#34;=&#34;+value+expires+&#34;; path=/&#34;;
&#125;
&#160;
function readCookie&#40;name&#41; &#123;
	var nameEQ = name + &#34;=&#34;;
	var ca = document.cookie.split&#40;';'&#41;;
	for&#40;var i=0;i &#60; ca.length;i++&#41; &#123;
		var c = ca&#91;i&#93;;
		while &#40;c.charAt&#40;0&#41;==' '&#41; c = c.substring&#40;1,c.length&#41;;
		if &#40;c.indexOf&#40;nameEQ&#41; == 0&#41; 
   [...]]]></description>
			<content:encoded><![CDATA[<p>การ set cookie ให้ใช้งานได้โดยใช้ javascript สามารถทำได้โดย<br />
ใช้ function นี้</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> createCookie<span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #339933;">,</span>value<span style="color: #339933;">,</span>days<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>days<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> date <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		date.<span style="color: #660066;">setTime</span><span style="color: #009900;">&#40;</span>date.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span>days<span style="color: #339933;">*</span><span style="color: #CC0000;">24</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> expires <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;; expires=&quot;</span><span style="color: #339933;">+</span>date.<span style="color: #660066;">toGMTString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #003366; font-weight: bold;">var</span> expires <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
	document.<span style="color: #660066;">cookie</span> <span style="color: #339933;">=</span> <span style="color: #000066;">name</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;=&quot;</span><span style="color: #339933;">+</span>value<span style="color: #339933;">+</span>expires<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;; path=/&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> readCookie<span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> nameEQ <span style="color: #339933;">=</span> <span style="color: #000066;">name</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;=&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> ca <span style="color: #339933;">=</span> document.<span style="color: #660066;">cookie</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">';'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i <span style="color: #339933;">&lt;</span> ca.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> c <span style="color: #339933;">=</span> ca<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>c.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">' '</span><span style="color: #009900;">&#41;</span> c <span style="color: #339933;">=</span> c.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span>c.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>c.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>nameEQ<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> 
                   <span style="color: #000066; font-weight: bold;">return</span> c.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span>nameEQ.<span style="color: #660066;">length</span><span style="color: #339933;">,</span>c.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> eraseCookie<span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	createCookie<span style="color: #009900;">&#40;</span><span style="color: #000066;">name</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">,-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p><strong>วิธีใช้งาน</strong></p>
<p>&nbsp;</p>
<p><u>สร้าง cookie</u> โดย<br />
createCookie(&#8217;ชื่อ cookie&#8217;,'ค่าใน cookie นั้น&#8217;,เวลาของ cookie หน่วยเป็นวัน)</p>
<p>ตัวอย่างการใช้งาน<br />
createCookie(&#8217;webshowpow&#8217;,'valuecookie&#8217;,7)</p>
<p>ปล. ถ้าเวลาของ cookie ไม่ได้ใส่ cookie นั้นจะหมดอายุเมื่อปิดบราวเซอร์</p>
<p>&nbsp;</p>
<p><u>อ่านค่าใน cookie</u> โดย<br />
readCookie(name)</p>
<p>ตัวอย่างการใช้งาน<br />
readCookie(&#8217;webshowpow&#8217;)</p>
<p>&nbsp;</p>
<p><u>ลบ cookie</u> โดย<br />
eraseCookie(name)</p>
<p>ตัวอย่างการใช้งาน<br />
eraseCookie(&#8217;webshowpow&#8217;)</p>
<p>&nbsp;</p>
<p>ที่มา<br />
http://www.quirksmode.org/js/cookies.html</p>
<img src="http://www.webshowpow.com/?ak_action=api_record_view&id=235&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.webshowpow.com/javascipt-%e0%b8%81%e0%b8%b1%e0%b8%9a-cookie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ลบข้อความแนะนำของ text input</title>
		<link>http://www.webshowpow.com/%e0%b8%a5%e0%b8%9a%e0%b8%82%e0%b9%89%e0%b8%ad%e0%b8%84%e0%b8%a7%e0%b8%b2%e0%b8%a1%e0%b9%81%e0%b8%99%e0%b8%b0%e0%b8%99%e0%b8%b3%e0%b8%82%e0%b8%ad%e0%b8%87-text-input/</link>
		<comments>http://www.webshowpow.com/%e0%b8%a5%e0%b8%9a%e0%b8%82%e0%b9%89%e0%b8%ad%e0%b8%84%e0%b8%a7%e0%b8%b2%e0%b8%a1%e0%b9%81%e0%b8%99%e0%b8%b0%e0%b8%99%e0%b8%b3%e0%b8%82%e0%b8%ad%e0%b8%87-text-input/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 17:47:15 +0000</pubDate>
		<dc:creator>เลนส์เว้า</dc:creator>
				<category><![CDATA[ทิปการเขียน]]></category>
		<category><![CDATA[autocomplete]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[ข้อความ]]></category>
		<category><![CDATA[พิมพ์]]></category>
		<category><![CDATA[โปรแกรม]]></category>

		<guid isPermaLink="false">http://www.webshowpow.com/?p=224</guid>
		<description><![CDATA[ในเวลาที่เรากดคลิกที่ text input  ปกติแล้วจะมีรายการข้อความที่เราเคยพิมพ์ไปแล้ว
แสดงขึ้นมาอัตโนมัติ  ซึ่งมันก็สะดวกดี แต่ในบางครั้งเราเขียนโปรแกรมที่มี
ความปลอดภัยสูง  เราก็ไม่อยากจะให้มีข้อความที่เราพิมพฺ์ไปแล้วแสดงขึ้นมา
เราสามารถทำได้โดยเพิ่ม code เข้าไปดังนี้

1
&#60;input name=&#34;textname&#34; type=&#34;text&#34; id=&#34;textname&#34; autocomplete=&#34;off&#34; /&#62;

]]></description>
			<content:encoded><![CDATA[<p>ในเวลาที่เรากดคลิกที่ text input  ปกติแล้วจะมีรายการข้อความที่เราเคยพิมพ์ไปแล้ว<br />
แสดงขึ้นมาอัตโนมัติ  ซึ่งมันก็สะดวกดี แต่ในบางครั้งเราเขียนโปรแกรมที่มี<br />
ความปลอดภัยสูง  เราก็ไม่อยากจะให้มีข้อความที่เราพิมพฺ์ไปแล้วแสดงขึ้นมา<br />
เราสามารถทำได้โดยเพิ่ม code เข้าไปดังนี้</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;textname&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;textname&quot;</span> autocomplete<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;off&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></td></tr></table></div>

<img src="http://www.webshowpow.com/?ak_action=api_record_view&id=224&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.webshowpow.com/%e0%b8%a5%e0%b8%9a%e0%b8%82%e0%b9%89%e0%b8%ad%e0%b8%84%e0%b8%a7%e0%b8%b2%e0%b8%a1%e0%b9%81%e0%b8%99%e0%b8%b0%e0%b8%99%e0%b8%b3%e0%b8%82%e0%b8%ad%e0%b8%87-text-input/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ทำไมชื่อไฟล์เป็นสีฟ้า</title>
		<link>http://www.webshowpow.com/%e0%b8%97%e0%b8%b3%e0%b9%84%e0%b8%a1%e0%b8%8a%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b9%84%e0%b8%9f%e0%b8%a5%e0%b9%8c%e0%b9%80%e0%b8%9b%e0%b9%87%e0%b8%99%e0%b8%aa%e0%b8%b5%e0%b8%9f%e0%b9%89%e0%b8%b2/</link>
		<comments>http://www.webshowpow.com/%e0%b8%97%e0%b8%b3%e0%b9%84%e0%b8%a1%e0%b8%8a%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b9%84%e0%b8%9f%e0%b8%a5%e0%b9%8c%e0%b9%80%e0%b8%9b%e0%b9%87%e0%b8%99%e0%b8%aa%e0%b8%b5%e0%b8%9f%e0%b9%89%e0%b8%b2/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 17:08:31 +0000</pubDate>
		<dc:creator>เลนส์เว้า</dc:creator>
				<category><![CDATA[ทิปการเขียน]]></category>
		<category><![CDATA[Disk Defragmenter]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[จัดเรียง]]></category>
		<category><![CDATA[ชื่อไฟล์]]></category>
		<category><![CDATA[บีบอัด]]></category>
		<category><![CDATA[รวดเร็ว]]></category>
		<category><![CDATA[สีฟ้า]]></category>
		<category><![CDATA[ใกล้กัน]]></category>
		<category><![CDATA[ไฟล์]]></category>

		<guid isPermaLink="false">http://www.webshowpow.com/?p=216</guid>
		<description><![CDATA[
ทำไมชื่อไฟล์เป็นสีฟ้า
ชื่อไฟล์เป็นฟ้า  มักจะเกิดเมื่อเราใช้่งานโปรแกรม Disk Defragmenter
เนื่องจากโปรแกรม Disk Defragmenter จะทำการจัดเรียงไฟล์ต่าง ๆ
ให้ไฟล์ที่มักจะใช้รวมกันอยู่ใกล้ ๆ กัน เพื่อความเร็วในการทำงาน
และไฟล์ที่ไม่ค่อยได้ใช้ ก็ทำการบีบอัด ซึ่งจะทำให้ไฟล์ที่โดน
การบีบอัด เป็นสีฟ้า
แต่ถ้าเราไม่อยากให้ชื่อไฟล์เป็นสีฟ้า มีทางแก้ไข 2 วิธี

1. คลิกขวาที่ไฟล์นั้น ๆ แล้วเลือก Properties แล้วกดที่ปุ่ม &#8220;Advanced&#8230;&#8221;
จากนั้นก็ติกออกที่ &#8220;Compress contents to save disk space&#8221;
&#160;
2. เข้าที่ My Computer แล้วเลือกไปที่ Tools -> Folder Options &#8230;
จากนั้นเลือกไปที่ Tab &#8220;View&#8221; แล้วติกออกที่
&#8220;Show encrypted or compressed NTFS files in color&#8221;
&#160;
หวังว่าคงเข้าใจ และ แก้ไขปัญหาชื่อไฟล์สีฟ้าได้นะครับ
&#160;
]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.webshowpow.com/wp-content/uploads/2009/12/blue_file.jpg" alt="รูปของเทคนิค ทำไมชื่อไฟล์เป็นสีฟ้า" title="รูปของเทคนิค ทำไมชื่อไฟล์เป็นสีฟ้า" width="550" height="225" class="alignnone size-full wp-image-218" /></p>
<p><strong>ทำไมชื่อไฟล์เป็นสีฟ้า</strong></p>
<p>ชื่อไฟล์เป็นฟ้า  มักจะเกิดเมื่อเราใช้่งานโปรแกรม Disk Defragmenter<br />
เนื่องจากโปรแกรม Disk Defragmenter จะทำการจัดเรียงไฟล์ต่าง ๆ<br />
ให้ไฟล์ที่มักจะใช้รวมกันอยู่ใกล้ ๆ กัน เพื่อความเร็วในการทำงาน<br />
และไฟล์ที่ไม่ค่อยได้ใช้ ก็ทำการบีบอัด ซึ่งจะทำให้ไฟล์ที่โดน<br />
การบีบอัด เป็นสีฟ้า</p>
<p>แต่ถ้าเราไม่อยากให้ชื่อไฟล์เป็นสีฟ้า มีทางแก้ไข 2 วิธี</p>
<p><span id="more-216"></span></p>
<p><strong>1. </strong>คลิกขวาที่ไฟล์นั้น ๆ แล้วเลือก <strong>Properties</strong> แล้วกดที่ปุ่ม <strong>&#8220;Advanced&#8230;&#8221;</strong><br />
จากนั้นก็ติกออกที่ <strong>&#8220;Compress contents to save disk space&#8221;</strong></p>
<div id="attachment_217" class="wp-caption alignnone" style="width: 396px"><img src="http://www.webshowpow.com/wp-content/uploads/2009/12/advanced.jpg" alt="รูปของเทคนิค ทำไมชื่อไฟล์เป็นสีฟ้า" title="รูปของเทคนิค ทำไมชื่อไฟล์เป็นสีฟ้า" width="384" height="294" class="alignnone size-full wp-image-217" /><p class="wp-caption-text">ติกออกที่ Compress contents to save disk space</p></div>
<p>&nbsp;</p>
<p><strong>2. </strong>เข้าที่ <strong>My Computer</strong> แล้วเลือกไปที่ <strong>Tools -> Folder Options &#8230;</strong><br />
จากนั้นเลือกไปที่ Tab <strong>&#8220;View&#8221;</strong> แล้วติกออกที่<br />
<strong>&#8220;Show encrypted or compressed NTFS files in color&#8221;</strong></p>
<div id="attachment_220" class="wp-caption alignnone" style="width: 396px"><img src="http://www.webshowpow.com/wp-content/uploads/2009/12/folderoption.jpg" alt="รูปของเทคนิค ทำไมชื่อไฟล์เป็นสีฟ้า" title="รูปของเทคนิค ทำไมชื่อไฟล์เป็นสีฟ้า" width="386" height="475" class="size-full wp-image-220" /><p class="wp-caption-text">ติกออกที่ Show encrypted or compressed NTFS files in color</p></div>
<p>&nbsp;</p>
<blockquote><p>หวังว่าคงเข้าใจ และ แก้ไขปัญหาชื่อไฟล์สีฟ้าได้นะครับ</p></blockquote>
<p>&nbsp;</p>
<img src="http://www.webshowpow.com/?ak_action=api_record_view&id=216&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.webshowpow.com/%e0%b8%97%e0%b8%b3%e0%b9%84%e0%b8%a1%e0%b8%8a%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b9%84%e0%b8%9f%e0%b8%a5%e0%b9%8c%e0%b9%80%e0%b8%9b%e0%b9%87%e0%b8%99%e0%b8%aa%e0%b8%b5%e0%b8%9f%e0%b9%89%e0%b8%b2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>วิธีการหาตัวเลขแบบไม่ซ้ำ ใน array</title>
		<link>http://www.webshowpow.com/%e0%b8%ab%e0%b8%b2%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%80%e0%b8%a5%e0%b8%82%e0%b9%81%e0%b8%9a%e0%b8%9a%e0%b9%84%e0%b8%a1%e0%b9%88%e0%b8%8b%e0%b9%89%e0%b8%b3/</link>
		<comments>http://www.webshowpow.com/%e0%b8%ab%e0%b8%b2%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%80%e0%b8%a5%e0%b8%82%e0%b9%81%e0%b8%9a%e0%b8%9a%e0%b9%84%e0%b8%a1%e0%b9%88%e0%b8%8b%e0%b9%89%e0%b8%b3/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 10:40:05 +0000</pubDate>
		<dc:creator>เลนส์เว้า</dc:creator>
				<category><![CDATA[ทิปการเขียน]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[ตัวเลข]]></category>
		<category><![CDATA[หา]]></category>
		<category><![CDATA[ไม่ซ้ำ]]></category>

		<guid isPermaLink="false">http://www.webshowpow.com/?p=136</guid>
		<description><![CDATA[
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
&#60;?php
$num=3;
$arr = array&#40;&#34;1&#34;,&#34;2&#34;,&#34;3&#34;,&#34;4&#34;,&#34;5&#34;,&#34;6&#34;,&#34;7&#34;,&#34;8&#34;&#41;;
$count_arr=count&#40;$arr&#41;;
&#160;
$arrName= array&#40;&#41;;
&#160;
$idx=0;
&#160;
while&#40;$idx&#60;$num&#41; 
&#123;
	$id_rand = rand&#40;0,$count_arr-1&#41;;
	if &#40;!in_array&#40;$arr&#91;$id_rand&#93;,$arrName&#41;&#41;
	&#123;
		$arrName&#91;$idx&#93;=$arr&#91;$id_rand&#93;;
		$idx++;
	&#125;
&#125; 
&#160;
print_r&#40;$arrName&#41;;
?&#62;

โดยที่
$num คือ จำนวนตัวเลขที่ต้องการ
$arr คือ array ที่เก็บข้อมูลตัวเลข
&#160;
จริง ๆ แล้วเอาไปประยุกต์ใช้กับตัวอักษรก็ได้นะ  
&#160;
]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$num</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$arr</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;2&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;3&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;4&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;5&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;6&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;7&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$count_arr</span><span style="color: #339933;">=</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$arrName</span><span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$idx</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$idx</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$num</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$id_rand</span> <span style="color: #339933;">=</span> <span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$count_arr</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$id_rand</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$arrName</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$arrName</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$idx</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$id_rand</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$idx</span><span style="color: #339933;">++;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arrName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>โดยที่<br />
$num คือ จำนวนตัวเลขที่ต้องการ<br />
$arr คือ array ที่เก็บข้อมูลตัวเลข</p>
<p>&nbsp;</p>
<blockquote><p>จริง ๆ แล้วเอาไปประยุกต์ใช้กับตัวอักษรก็ได้นะ <img src='http://www.webshowpow.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p></blockquote>
<p>&nbsp;</p>
<img src="http://www.webshowpow.com/?ak_action=api_record_view&id=136&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.webshowpow.com/%e0%b8%ab%e0%b8%b2%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%80%e0%b8%a5%e0%b8%82%e0%b9%81%e0%b8%9a%e0%b8%9a%e0%b9%84%e0%b8%a1%e0%b9%88%e0%b8%8b%e0%b9%89%e0%b8%b3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Background image link</title>
		<link>http://www.webshowpow.com/css-background-image-link/</link>
		<comments>http://www.webshowpow.com/css-background-image-link/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 10:14:44 +0000</pubDate>
		<dc:creator>เลนส์เว้า</dc:creator>
				<category><![CDATA[ทิปการเขียน]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.webshowpow.com/?p=117</guid>
		<description><![CDATA[ในการทำให้รูปภาพสามารถ link ได้ ถ้าเขียนโดย xhtml ก็จะเขียนในลักษณะนี้

1
&#60;a href=&#34;urllink.html&#34;&#62;&#60;img src=&#34;logo.jpg&#34; alt=&#34;&#34; border=&#34;0&#34; /&#62;&#60;/a&#62;

แต่ถ้าเราเขียนในรูปแบบของ css เรามักจะกำหนดรูปภาพไปอยู่ในส่วนของ css
ซึ่งทำให้เราไม่ได้เขียนให้รูปภาพ link ได้ในรูปแบบเดิมได้ (รูปแบบ xhtml)
แต่ถ้าจะให้รูปภาพ สามารถ link ได้ ขอแนะนำ 1 วิธีการ โดยทำตามนี้

ส่วนของ css

1
2
3
4
5
6
7
8
9
10
 &#60;style type=&#34;text/css&#34;&#62;
#logolink &#123;
display: block;
height: 100px;
width: 200px;
background-image: url&#40;logo.jpg&#41;;
&#125;
&#160;
#bglink span &#123; display: none; &#125;
&#60;/style&#62;

ส่วนวิธีเรียกใช้ก็คือ

1
2
3
&#60;p id=&#34;logolink&#34;&#62;
&#60;a id=&#34;bglink&#34; href=&#34;urllink.html&#34;&#62;&#60;span&#62;Click my logo&#60;/span&#62;&#60;/a&#62;
&#60;/p&#62;

&#160;
จาก
http://www.webdeveloper.com/forum/showthread.php?t=188503
&#160;
หวังว่าคงทำกันได้นะครับ
&#160;
]]></description>
			<content:encoded><![CDATA[<p>ในการทำให้รูปภาพสามารถ link ได้ ถ้าเขียนโดย xhtml ก็จะเขียนในลักษณะนี้</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;urllink.html&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;logo.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">border</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></pre></td></tr></table></div>

<p>แต่ถ้าเราเขียนในรูปแบบของ css เรามักจะกำหนดรูปภาพไปอยู่ในส่วนของ css<br />
ซึ่งทำให้เราไม่ได้เขียนให้รูปภาพ link ได้ในรูปแบบเดิมได้ (รูปแบบ xhtml)<br />
แต่ถ้าจะให้รูปภาพ สามารถ link ได้ ขอแนะนำ 1 วิธีการ โดยทำตามนี้</p>
<p><span id="more-117"></span></p>
<p><strong>ส่วนของ css</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"> &lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
<span style="color: #cc00cc;">#logolink</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">logo.jpg</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#bglink</span> span <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p><strong>ส่วนวิธีเรียกใช้ก็คือ</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;logolink&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;bglink&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;urllink.html&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span>Click my logo<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>จาก<br />
http://www.webdeveloper.com/forum/showthread.php?t=188503</p>
<p>&nbsp;</p>
<blockquote><p>หวังว่าคงทำกันได้นะครับ</p></blockquote>
<p>&nbsp;</p>
<img src="http://www.webshowpow.com/?ak_action=api_record_view&id=117&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.webshowpow.com/css-background-image-link/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>สั่งพิมพ์เอกสารเป็นหน้าๆ โดยใช้ CSS ควบคุม</title>
		<link>http://www.webshowpow.com/%e0%b8%aa%e0%b8%b1%e0%b9%88%e0%b8%87%e0%b8%9e%e0%b8%b4%e0%b8%a1%e0%b8%9e%e0%b9%8c%e0%b9%80%e0%b8%ad%e0%b8%81%e0%b8%aa%e0%b8%b2%e0%b8%a3-css%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1/</link>
		<comments>http://www.webshowpow.com/%e0%b8%aa%e0%b8%b1%e0%b9%88%e0%b8%87%e0%b8%9e%e0%b8%b4%e0%b8%a1%e0%b8%9e%e0%b9%8c%e0%b9%80%e0%b8%ad%e0%b8%81%e0%b8%aa%e0%b8%b2%e0%b8%a3-css%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 10:54:41 +0000</pubDate>
		<dc:creator>เลนส์เว้า</dc:creator>
				<category><![CDATA[ทิปการเขียน]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[หน้า]]></category>
		<category><![CDATA[เทคนิค]]></category>

		<guid isPermaLink="false">http://www.webshowpow.com/?p=34</guid>
		<description><![CDATA[ในบางครั้งเราต้องการเขียนโปรแกรมเพื่อพิมพ์เอกสาร แต่เราก็ต้องมาทดสอบในการพิมพ์ว่าต้อง
เว้นวรรคมากแค่ไหน ถึงจะไปหน้าใหม่ แต่วิธีที่จะบอกทำให้เราสามารถ ควบคุมการพิมพ์ของเรา
ได้ดีขึ้น  ได้สะดวกมากขึ้น
&#160;
ส่วนของ CSS

1
2
3
4
5
6
7
8
9
10
&#60;style type=&#34;text/css&#34;&#62;
&#60;!--
@media print {
div.page  &#123;
height: 100%;
margin: 0px 0px 0px 0px;
  &#125;
&#125;
--&#62;
&#60;/style&#62;

&#160;
ส่วนของ Html

1
2
&#60;div class=&#34;page&#34;&#62;aa&#60;/div&#62;
&#60;div class=&#34;page&#34;&#62;bb&#60;/div&#62;

จากตัวอย่างจะเห็นว่า ใน CSS มีการเรียกใช้ Media Print คือการสั่งให้จัดการกับสื่อหรือ
Output ที่เป็น Printer ซึ่งเรากำหนดให้มีผลกับช่วง tag &#60;div&#62;
เมื่อคุณลองสั่งรัน Script แล้วสั่งพิมพ์ออกมา ก็จะเห็นว่า Printer
จะพิมพ์ออกมา 2 หน้า โดยหน้าแรกจะเป็น aa หน้า 2 จะเป็น bb
&#160;
อ้างอิงจาก www.siamdev.com
&#160;
]]></description>
			<content:encoded><![CDATA[<p>ในบางครั้งเราต้องการเขียนโปรแกรมเพื่อพิมพ์เอกสาร แต่เราก็ต้องมาทดสอบในการพิมพ์ว่าต้อง<br />
เว้นวรรคมากแค่ไหน ถึงจะไปหน้าใหม่ แต่วิธีที่จะบอกทำให้เราสามารถ ควบคุมการพิมพ์ของเรา<br />
ได้ดีขึ้น  ได้สะดวกมากขึ้น</p>
<p>&nbsp;</p>
<p>ส่วนของ CSS</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="css" style="font-family:monospace;">&lt;style type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #00AA00;">&gt;</span>
&lt;!--
<span style="color: #a1a100;">@media print {</span>
div<span style="color: #6666ff;">.page</span>  <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">0px</span> <span style="color: #933;">0px</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
--<span style="color: #00AA00;">&gt;</span>
&lt;/style<span style="color: #00AA00;">&gt;</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>ส่วนของ Html</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page&quot;</span>&gt;</span>aa<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page&quot;</span>&gt;</span>bb<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

<p>จากตัวอย่างจะเห็นว่า ใน CSS มีการเรียกใช้ Media Print คือการสั่งให้จัดการกับสื่อหรือ<br />
Output ที่เป็น Printer ซึ่งเรากำหนดให้มีผลกับช่วง tag &lt;div&gt;<br />
เมื่อคุณลองสั่งรัน Script แล้วสั่งพิมพ์ออกมา ก็จะเห็นว่า Printer<br />
จะพิมพ์ออกมา 2 หน้า โดยหน้าแรกจะเป็น aa หน้า 2 จะเป็น bb</p>
<p>&nbsp;</p>
<p>อ้างอิงจาก www.siamdev.com</p>
<p>&nbsp;</p>
<img src="http://www.webshowpow.com/?ak_action=api_record_view&id=34&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.webshowpow.com/%e0%b8%aa%e0%b8%b1%e0%b9%88%e0%b8%87%e0%b8%9e%e0%b8%b4%e0%b8%a1%e0%b8%9e%e0%b9%8c%e0%b9%80%e0%b8%ad%e0%b8%81%e0%b8%aa%e0%b8%b2%e0%b8%a3-css%e0%b8%84%e0%b8%a7%e0%b8%9a%e0%b8%84%e0%b8%b8%e0%b8%a1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>วิธีการส่งค่าไปใน setTimeout()</title>
		<link>http://www.webshowpow.com/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%aa%e0%b9%88%e0%b8%87%e0%b8%84%e0%b9%88%e0%b8%b2%e0%b9%84%e0%b8%9b%e0%b9%83%e0%b8%99-settimeout/</link>
		<comments>http://www.webshowpow.com/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%aa%e0%b9%88%e0%b8%87%e0%b8%84%e0%b9%88%e0%b8%b2%e0%b9%84%e0%b8%9b%e0%b9%83%e0%b8%99-settimeout/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 10:39:51 +0000</pubDate>
		<dc:creator>เลนส์เว้า</dc:creator>
				<category><![CDATA[ทิปการเขียน]]></category>
		<category><![CDATA[eval]]></category>
		<category><![CDATA[ฟังก์ชั่น]]></category>
		<category><![CDATA[หน่วง]]></category>
		<category><![CDATA[เทคนิค]]></category>
		<category><![CDATA[เวลา]]></category>
		<category><![CDATA[โปรแกรม]]></category>

		<guid isPermaLink="false">http://www.webshowpow.com/?p=30</guid>
		<description><![CDATA[ผมเคยเขียนโปรแกรม แล้วต้องการหน่วงฟังก์ชั่นการทำงาน แต่ต้องการส่งค่าตัวแปร ไปในฟังก์ชั่นนั้นด้วย
ซึ่งผมก็หาวิธีตั้งมากมาย แล้วก็หาไม่เจอซักที แต่สุดท้ายก็รู้จนได้
นั้นก็คือ

1
2
3
4
5
&#60;script type=&#34;text/javascript&#34;&#62;
  var bTime=4000; // หมายถึง หน่วงเวลาไว้ 4 วินาที
  var bVal=&#34;rotateimage('&#34;+obj+&#34;')&#34;;
  setTimeout&#40;eval&#40;bVal&#41;,bTime&#41;;
&#60;/script&#62;

โดยที่
bTime คือ ค่าที่ใช้หน่วงโปรแกรม หน่วยคือ มิลลิวินาที (10-3)
rotateimage คือ ชื่อ function ที่เรียกใช้
obj คือ ตัวแปรที่ต้องการส่งไป 
&#160;
ต้องขอขอบคุณน้อง ATT@MKT ด้วยที่แนะนำวิธีนี้  
&#160;
]]></description>
			<content:encoded><![CDATA[<p>ผมเคยเขียนโปรแกรม แล้วต้องการหน่วงฟังก์ชั่นการทำงาน แต่ต้องการส่งค่าตัวแปร ไปในฟังก์ชั่นนั้นด้วย<br />
ซึ่งผมก็หาวิธีตั้งมากมาย แล้วก็หาไม่เจอซักที แต่สุดท้ายก็รู้จนได้<br />
นั้นก็คือ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #000000; font-weight: bold;">var</span> bTime<span style="color: #339933;">=</span><span style="color: #cc66cc;">4000</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// หมายถึง หน่วงเวลาไว้ 4 วินาที</span>
  <span style="color: #000000; font-weight: bold;">var</span> bVal<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;rotateimage('&quot;</span><span style="color: #339933;">+</span>obj<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;')&quot;</span><span style="color: #339933;">;</span>
  setTimeout<span style="color: #009900;">&#40;</span><span style="color: #990000;">eval</span><span style="color: #009900;">&#40;</span>bVal<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>bTime<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></pre></td></tr></table></div>

<p>โดยที่<br />
bTime คือ ค่าที่ใช้หน่วงโปรแกรม หน่วยคือ มิลลิวินาที (10-3)<br />
rotateimage คือ ชื่อ function ที่เรียกใช้<br />
obj คือ ตัวแปรที่ต้องการส่งไป </p>
<p>&nbsp;</p>
<p>ต้องขอขอบคุณน้อง ATT@MKT ด้วยที่แนะนำวิธีนี้ <img src='http://www.webshowpow.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&nbsp;</p>
<img src="http://www.webshowpow.com/?ak_action=api_record_view&id=30&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.webshowpow.com/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%aa%e0%b9%88%e0%b8%87%e0%b8%84%e0%b9%88%e0%b8%b2%e0%b9%84%e0%b8%9b%e0%b9%83%e0%b8%99-settimeout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
