[PHP Room] แชร์ PHP กันวันละนิด

เริ่มโดย EThaiZone, 05 มีนาคม 2007, 19:27:38

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

EThaiZone

สารบัญ PHP Room By EasyChill

ถ้า เปิดคุณอยากแสดง email แต่กลัวเรื่องโดนโปรแกรมไล่ดูดเมล์ ก็ต้อง เข้ารหัสอีเมล์ ? by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg82848.html#msg82848

เทคนิค ใช้ if แบบ ไม่มี if by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg82887.html#msg82887

เทคนิคการสร้าง 00001 (เทคนิคนี้จากคุณ Tee++; ) by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg82893.html#msg82893

การแสดงผลโดยไม่ใส่ echo และสั้นสุดๆ  by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg82897.html#msg82897

วิธีเพิ่มความเร็วให้กับ php อีกนีด  by aomnaruk
http://www.thaiseoboard.com/index.php/topic,6920.msg83192.html#msg83192

ใช้ลูปอย่างไรให้เหมาะสม ? by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg83364.html#msg83364

ตามคำขอ กันสแปมเมล์ by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg83430.html#msg83430

ตกม้าตายกะ header by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg83538.html#msg83538

มาเสริมให้นิดนึงครับกับ Function ที่มักจะใช้ร่วมกับ header คือพวก ob ต่างๆ  by Tee++;
http://www.thaiseoboard.com/index.php/topic,6920.msg83590.html#msg83590

function ใน PHP ที่ไม่ค่อยมีคนใช้กัน หรืออาจลืมไป by Tee++;
http://www.thaiseoboard.com/index.php/topic,6920.msg83819.html#msg83819

เทคนิคพิเศษที่ถูกซ่อน ระหว่าง string และ array by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg84216.html#msg84216

array_walk( array , callback function [, mixed userdata]) by Tee++;
http://www.thaiseoboard.com/index.php/topic,6920.msg84699.html#msg84699

เทคนิคเพิ่มความเร็ว และลดการใช้งาน mysql by ColdMoney
http://www.thaiseoboard.com/index.php/topic,6920.msg84707.html#msg84707

ต่อเนื่องจากโพสแคชไฟล์ของคุณ ColdMoney by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg84839.html#msg84839

การเก็บแคช(ต่อ) by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg85406.html#msg85406

การเรียกพาท by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg85410.html#msg85410

เคยมีหลายครั้งไหมที่อยากจัดการบทความที่มีทั้ง ขึ้นบรรทัดใหม่บ้าง จัดคำไม่เป็นส่วนบ้าง เดี๋ยววรรคยาวๆ สั้นๆ by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg87478.html#msg87478

สคริป Related จาก Google by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg87519.html#msg87519

ขั้นตอนคำสั่งการใช้ mysql by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg87888.html#msg87888

อยากจะเป็น PHP ต้องทำอย่างไร  by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg88340.html#msg88340

วิธีการทำผลการค้นหาแสดงเป็น % by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg94077.html#msg94077

เวลาตัดทดศนิยมด้วยฟังค์ชั่น round มันจะปัดเศษด้วย ทำอย่างไรถึงจะไม่ให้มันปัดเศษ by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg106114.html#msg106114

การทำ sitemap ให้อยู่ในรูป gzip by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg115153.html#msg115153

การตั้งค่า Parameter ในสภาพติดลบ by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg155392.html#msg155392

การทำรายการที่มี comma คั่น by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg159536.html#msg159536

การเรียกรายการข้อความโดยไม่เกิดปัญหา by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg162501.html#msg162501

ตอนพิเศษ : Loop in the loop by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg165938.html#msg165938

การใช้ cURL แทน file_get_contents ครับ แถมด้วยการปลอมตัวเป็น browser เพื่อหลอก server ด้วย  by lowprofile
http://www.thaiseoboard.com/index.php/topic,6920.msg169809.html#msg169809

วิธีการทำงานร่วมกันของ Html กะ PHP by Pipo
http://www.thaiseoboard.com/index.php/topic,6920.msg178146.html#msg178146

วิธีการทำงานร่วมกันของ Html กะ PHP by lowprofile
http://www.thaiseoboard.com/index.php/topic,6920.msg178527.html#msg178527

ความแตกต่างระหว่าง include กะ require by lowprofile
http://www.thaiseoboard.com/index.php/topic,6920.msg178532.html#msg178532

คำเตือนเรื่องการใช้ include by icez
http://www.thaiseoboard.com/index.php/topic,6920.msg180355.html#msg180355

วิธีการทำระบบ Tags ตามแบบฉบับ WEB2.0
by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg180588.html#msg180588

สำหรับบางสคิปบางตัวที่ทำงานเป็นเวลานานๆแต่ขี้เกียจเปิดเครื่องเพื่อรันสคิปทิ้งไว้(เปลืองไฟ)
by aomnaruk
http://www.thaiseoboard.com/index.php/topic,6920.msg181478.html#msg181478

ตัวอย่างการใช้ fsockopen ในการส่งข้อมูลแบบ POST by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg195440.html#msg195440

วิธีทำ redirect page แบบเว็บ anony by mixture
http://www.thaiseoboard.com/index.php/topic,6920.msg206604.html#msg206604

การรับส่งค่า ระหว่าง window หลัก และ popup และการเรียกใช้ parent ระหว่าง iframe กับ main iframe by nuijang24
http://www.thaiseoboard.com/index.php/topic,6920.msg213788.html#msg213788

@ คืออะไรครับ ไว้ทำอะไรเหรอ  ถาม  hurahura ตอบ by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg215572.html#msg215572

อัพเดต! สคริป Related จาก Google by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg218463.html#msg218463

สคริป Related จาก Google อัพเดต2! by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg218481.html#msg218481

User Online TXT by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg221008.html#msg221008

ฟังค์ชั่นแปลงภาษาไทยเป็น utf8 by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg225883.html#msg225883

ฟังค์ชั่นแปลง tis620 เป็น utf-8 อีกตัวครับ  by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg228813.html#msg228813

glob() by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg241386.html#msg241386

การเขียน Regex เพื่อเช็คภาษาไทย by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg241540.html#msg241540

คลาสแปลง UTF8 เป็น punycode by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg244187.html#msg244187

ฟังค์ชั่นแปลง utf8 กลับเป็น tis620 by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg244228.html#msg244228

เอาไว้ดึง Google Keyword Suggestion by aomnaruk
http://www.thaiseoboard.com/index.php/topic,6920.msg246639.html#msg246639

เรื่องหัวข้อเออเร่อหน่อยครับ  ว่าแต่ละอันหมายความว่ายังไง by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg254710.html#msg254710

ความเป็นไปได้ของ 1 ใน 100 by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg255001.html#msg255001

การเขียนตรวจสอบ Keyword Density อย่างง่ายๆ  by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg255006.html#msg255006

โค้ดทำ highlight keyword by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg258794.html#msg258794

Random Cron Script by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg261130.html#msg261130

สคริปใช้เอง ใช้ดึงพาทโดยตรงของยูทูป  by EThaiZone
http://www.thaiseoboard.com/index.php/topic,6920.msg263772.html#msg263772




เปิดห้องแชร์ PHP ครับ

ตอนแรกก็ไม่นึกอะไร แต่พอมานึกว่ามีห้องอังกฤษ (ของคุณ pete)
มันน่ามี php มั้งนะ ไหนๆ คอ php ก็เยอะ (กว่าครึ่งเป็นขาซุ่ม อิๆ)

คนไหนเป็น php ก็ช่วยมาแชร์ทริกต่างๆ กันบ้างนะครับ

วันนี้เริ่มด้วยอันนี้ละกัน

ถ้า เปิดคุณอยากแสดง email แต่กลัวเรื่องโดนโปรแกรมไล่ดูดเมล์
ก็ต้อง เข้ารหัสอีเมล์ ?

<?
$str = "I love you!";

for ($i = 0; $i < strlen( $str ); $i++ ) {
$unicode[] = "&#".ord($str[ $i ]).";";
}
$unicode = implode("",$unicode);

echo $unicode;
?>


ผลที่ได้คือ
I love you!

(ลอง view source ดูครับ)

ต่อแต่นี้ไปว่างๆ หรือมีไอเดียจะเอามาแปะครับ ^^

pete

ขอบคุณคับ เป็นอีก 1 กระทู้ที่น่าสนใจมากๆ
ขอเป็นแฟนกระทู้ 1 คนคับ ^^

[email protected]


aomnaruk

ร่วมแชร์ได้เปล่าครับ  :?:  :?:

melonsplitz

ขอเข้ามาเรียนด้วยคร้าาาบ อิอิ

Ctrl-Alt-Del

ขอเข้ามาซุ่มดูก่อนน่ะครับ ยังเขียน PHP ไม่เป็นเลย  :lol:
แต่เป็นกระทู้ที่น่าสนใจดีครับ แล้วจะมาติดตามเรื่อยๆครับ  :D
...

EThaiZone

อ้างถึงจาก: aomnarukร่วมแชร์ได้เปล่าครับ  :?:  :?:

ร่วมเลยขอรับ กระทู้มันได้มีเนื้อหาเยอะๆ  :D

successman

ขอเข้าร่วมเป็นนักเรียนด้วยนะครับ

pacapao

ขอบคุณมาก ที่คิดกระทู้นี้ขึ้นมา

มีประโยชน์กับโลกน้อยใบนี้มากคับ
[direct=http://www.pacapao.com/]แหล่งรวมความรู้พิสดาร และ สาวสวยจากทั่วโลก[/direct]

[direct=http://www.facebook.com/pacapao]สุดยอด นักปั่นบันลือโลก..[/direct]

ศูนย์จำหน่าย ไตรจีวร และ สังฆภัณฑ์ จำหน่าย กระทะทองเหลือง ช้อนส้อมทองเหลือง แจกัน เชิงเทียน กระถางธูปทองเหลือง ไตรจีวร และ สังฆภัณฑ์ หลายชนิด ชุดผ้าไตร ชุดสรงน้ำ ผ้าอาบน้ำฝน ชุดทำบุญคุณภาพดี-จัดส่งทั่วไทย [direct=http://www.facebook.com/Sangkhapann]สังฆภัณฑ์[/direct]

EThaiZone

#9
เทคนิค ใช้ if แบบ ไม่มี if

เป็นเทคนิคการสร้างเงื่อนไข โดยไม่ต้องพิมพ์ if
โดยวิธีนี้ใช้ได้ดีเวลาที่ทั้งจริงและเท็จ ต้องใช้ฟังค์ชั่นหรือการกระทำเหมือนกัน
เช่น ถ้าถูกให้แสดง yes ถ้าผิดให้แสดง no

ยกตัวอย่างจาก
if(2 > 1) {
    echo 'yes';
} else {
    echo 'no';
}

เราจะมีใช้เทคนิคจะเขียนได้เป็น

echo 2 > 1 ? 'yes' : 'no';

โครงสร้างจึงเป็น

ตัวเริ่มต้น เงื่อนไข ? การกระทำจริง : การกระทำเท็จ;

โดยตัวเริ่มต้นจะใช้เป็นฟังค์ชั่นหรือตัวแปรก็ได้
อีกตัวอย่าง
$a = 5;
$b = 2;
$i = $a == $b ? $a.' เท่ากับ '.$b : $a.' ไม่เท่ากับ '.$b;
echo $i;


หวังว่าจะมีประโยชน์นะครับ  :D

youcanberich

[direct=http://www.iheartpassiveincome.com/]อยากรู้ว่าผมทำเงินวันละ $1000 ได้ยังไง คลิ๊ก![/direct]
[direct=http://www.iheartpassiveincome.com/]ผมจะสอนให้คุณหารายได้แบบยั่งยืนบนโลกออนไลน์ รับประกันคุณทำได้แน่นอน[/direct]
[direct=http://www.iheartpassiveincome.com/]เหนื่อยกับการปั่นเว็บใช่มั้ย อยากทำเงินวันละ $100 และไม่ต้องลุ้นโดนแบนรายวัน ผมมีทางออกให้ คลิ๊กครับ![/direct]

EThaiZone

#11
เทคนิคการสร้าง 00001 (เทคนิคนี้จากคุณ Tee++; )

ปกติในค่าตัวแปร php จะกำหนดได้ 2 ชนิดแน่ๆ
คือตัวอักษรและตัวเลข แต่ก็มีหลายกรณีที่อยากให้ตัวเลขเป็นเหมือข้อความ
อย่าง 00001

ดังนั้นเราจะมาดูวิธีกันว่าจะทำยังไง ให้ หน้า 1 มี 0 และนำมาใช้คำนวณได้ด้วย ^^

$n = 1;
$n2 = sprintf("%05d", $n);


พอเรา echo $n2 จะได้ 00001
แล้วถ้าเราอยาก + - ก็ทำที่ $n แล้วถึงมาใช้ฟังค์ชั่น sprintf ช่วยครับ

อธิบาย %05d
% ใช้ในการระบุตำแหน่งการ แทนที่ ค่าในตัวแปรลงไปยังในข้อความ
โดยชนิดของค่าจะต้องอยู่หลัง % เสมอ
อย่าง %d ก็จะเป็นตัวเลข หรือ %s จะเป็นข้อความ

แต่ของเราเป็น %05d หมายถึงขอตำแหน่งตัวเลข ไว้ 5 ตำแหน่ง โดยเอา 0 แทนที่ข้างหน้า

ต้องลองทดสอบหลายๆ ตัวดูครับ จะรู้ว่าช่วยได้เยอะ
สามารถเอาไปประยุกต์ทำระบบบัญชีออนไลน์ก็ยังได้ครับ

%.4f จองค่าเป็นทศนิยม 4 ตำแหน่ง

http://au.php.net/sprintf

NongNatty

$a = (($b < 0 ? $b : -1));

เปรียบได้กับ

-----------

if($b < 0) {
$a = -1;
} else {
$a = $b;
}

-----------
$b = -1;
if($b > 0)
$a = $b

และอื่นๆ อีกเยอะแยะเลย
ที่เที่ยวไทย.com : ข้อมูลสถานที่[direct=http://www.teeteawthai.com/]ท่องเที่ยว[/direct] [direct=http://www.teeteawthai.com/พาเที่ยว]พาเที่ยว[/direct]สถานที่ท่องเที่ยวต่างๆ ในประเทศไทย

[direct=http://www.r24.org/hotelresortclub.com/]Hotel Booking Online[/direct] | [direct=http://www.r24.org/siamhotelresort.com/]Hotel Booking[/direct] |
[direct=http://www.teeteawthai.com/ido24/]ที่พัก[/direct]

NongNatty

อ้างถึงจาก: NongNatty$a = (($b < 0 ? $b : -1));

เปรียบได้กับ

-----------

if($b < 0) {
$a = -1;
} else {
$a = $b;
}

-----------
$b = -1;
if($b > 0)
$a = $b

และอื่นๆ อีกเยอะแยะเลย


ขอฝาก

ถึงคุณ NongNatty,

มีข้อความส่วนตัวมาถึงคุณ บนเว็บ "ThaiSEOBoard.com" และคุณได้กำหนดให้มีการแจ้งเตือนไว้ด้วย
คุณสามารถอ่านข้อความได้โดยคลิกที่ลิงค์ด้านล่างนี้:
http://www.thaiseoboard.com/privmsg.php?folder=inbox

คุณสามารถกำหนดไม่ให้มีการแจ้งเตือนได้ โดยการเปลี่ยนการตั้งค่าในข้อมูลส่วนตัว

--
โซวบักท้ง
ThaiSEOBoard.com

อันหยั๋งหว่า คลิ๊กแล้ว ไม่เห็นมีไรเลย
ที่เที่ยวไทย.com : ข้อมูลสถานที่[direct=http://www.teeteawthai.com/]ท่องเที่ยว[/direct] [direct=http://www.teeteawthai.com/พาเที่ยว]พาเที่ยว[/direct]สถานที่ท่องเที่ยวต่างๆ ในประเทศไทย

[direct=http://www.r24.org/hotelresortclub.com/]Hotel Booking Online[/direct] | [direct=http://www.r24.org/siamhotelresort.com/]Hotel Booking[/direct] |
[direct=http://www.teeteawthai.com/ido24/]ที่พัก[/direct]

EThaiZone

เทคนิคสุดท้ายของวัน
(มุขจะแป๊กแล้วอะ ใครก็ได้นึกไรออกมาโพสด้วยกันนะครับ)

การแสดงผลโดยไม่ใส่ echo และสั้นสุดๆ

เพราะเราจะใส่ printf (ปึ๊ก! ใครปารองเท้ามา อูยๆๆ ขำปะ ?)

หลายคนที่ชอบทำระบบเหมือนเทมเพลต
มักจะใช้ <? echo $var; ?>

ดังนั้นทริกนี้จะทำให้มันสั้นสุดๆ จะได้เป็น
<?=$var?>

สั้นปะ หวังว่าจะได้ใช้ประโยชน์นะครับ  :D

และแล้วก็หากินไปได้อีก 1 โพส
แต่พรุ่งนี้จะเอาไรมาโพสดีหว่า 555+

Yube

ขอติดตามด้วยคนครับ
คาดว่าจะเป็นอีกหนึ่งกระทู้ที่ hot ในอนาคต  :D  :D

ครอบครัวไทยเสียวบอร์ด

Tee++;

เยี่ยมครับ ขออ่านด้วยคน ว่าแต่ ...


เมื่อไหร่จะมีห้องโปรแกรมเมอร์นะ  :cry:
[direct=http://laravel.in.th]Laravel in Thai[/direct]
[direct=http://jquerytips.com]jQueryTips by Tee++;[/direct]
[direct=https://www.facebook.com/jQueryTips]jQueryTips Page[/direct]
[direct=https://www.facebook.com/Laravel.in.th]Laravel in Thai Page[/direct]
[direct=https://twitter.com/Teepluss]Teepluss's Twitter[/direct]


ColdMoney

น่าสนอ่ะครับ แต่ไม่รู้จาแชร์ไรดีอ่ะครับ  :lol:
[direct=https://www.jumnong.com]รับจำนอง[/direct] [direct=https://burapasup.com]รับซื้อบ้าน[/direct] [direct=https://kadsan.com]สินค้าราคาถูก[/direct] [direct=https://checkcheap.com]เปรียบเทียบราคา[/direct]

7

คุณ EThaiZone ไม่ทำ blog ต่อหล่ะ แต่อย่าใช้ msn เลยนะ ขอร้อง  :lol: