B / Y / U / S
HOME À¥ È£½ºÆà µµ¸ÞÀÎ ¸Å´º¾ó °í°´Áö¿ø ¼³Á¤Á¤º¸ °èÁ¤½Åû 2024-12-28 Saturday 
À¥ È£½ºÆÃ
# °øÁö »çÇ×
# ÀÚÁÖ ¹¯´Â Áú¹®
# Áú¹®°ú ´äº¯
# °¡ÀÔ ¹®ÀÇ
Ä¿¹Â´ÏƼ
# ÀÚÀ¯°Ô½ÃÆÇ
# ¸®´ª½ºÆÁ
# ¾ÆÀÌÅ¥ Å×½ºÆ®
# ³»È¨ ¼Ò°³
# °Ö·¯¸®
# ÀÚ·á½Ç

  ¸®´ª½ºÆÁ  Go Unix Power Tools Online Book Go Bash Guide
Read No. 64 article 2002-01-17 10:21:40
NickName   Ç®ºñ´©
Subject   [PHP] ÇѱÛÀ» ±ú¸Ô´Â htmlspecialchars() ÇÔ¼ö.
°Ô½ÃÆǵîÀ» º¸¸é ƯÁ¤ ÇѱÛÀÌ "££4022;" Çü½ÄÀ¸·Î ÄÚµåÈ­µÇ´Â°É º¼ ¼ö Àִµ¥¿ä. 
¹üÀÎÀº htmlspecialchars() ¿´½À´Ï´Ù. 

¿ÀŸ³ª Çر«ÇÑ Åë½Å¿ë¾î¸¦ »ç¿ëÇÒ °æ¿ì¿¡ À§¿Í °°Àº ¹®Á¦°¡ ¹ß»ýÇÕ´Ï´Ù. 

À§ ÇÔ¼ö¸¦ »ç¿ëÇÏÁö ¾ÊÀ¸¸é ¿ø·¡ ±ÛÀÚ°¡ ±×´ë·Î ³ª¿É´Ï´Ù. 

ÇØ°á¹æ¹ýÀº htmlspecialchars()´ë½Å.. 
$new_string = ereg_replace('<','£¦lt;',$string); 
ÀÌ·¸°Ô ÇÏ½Ã¸é µÇ°Ú½À´Ï´Ù. ¹°·Ð '>'µµ '£¦gt;'·Î º¯°æÇÏ¸é µÇ°ÚÁö¸¸ '<'¸¸ ¹Ù±îÁÒµµ Àß µË´Ï´Ù. 


¾Æ·¡ ´ëüÇÔ¼ö¸¦ ¼Ò°³ÇÕ´Ï´Ù. 

// htmlspecialchars °¡ ÇѱÛÀ» ±ú¸ÔÀ¸´Ï±î. »õ·ÎÁ¤ÀÇÇÑ´Ù. 
function htmlspecialchars2($str) { 
$str = str_replace( "&", "&", $str ); 
$str = str_replace( """,""", $str ); 
$str = str_replace( "'","'", $str ); 
$str = str_replace( "<", "<", $str ); 
$str = str_replace( ">", ">", $str ); 
return $str; 
}
Regist Addr [ 192.168.0.2 ] ¸ñ·Ïº¸±â À­±Û ¾Æ·§±Û
Á¤±ÔÇ¥Çö½Ä [ »ó¼¼ °Ë»ö ]
Page Loading [ 0.02 Sec ] SQL Time [ 0 Sec ]

Copyleft 1999-2024 by JSBoard Open Project
Theme Designed by IDOO And follow GPL2

°³ÀÎÁ¤º¸ Ãë±Þ¹æħ ÀÌ¿ë ¾à°ü »çÀÌÆ® ¸Ê ¾îµå¹Î °ü¸®