새 글
| |
| 스터디 < PHP |
|
<?
$s = "02-123-4567 kag@naver.com";
$s = preg_replace("/([0-9]{2,3}[- \.\/])?[0-9]{3,4}[- \.\/][0-9]{4}/", "<font color=silver>*** 내용에 들어있는 전화번호는 자동으로 보여지지 않습니다 ***</font>", $s);
$s = preg_replace("/(([a-z0-9_]|\-|\.)+#([^[:space:]]*)([[:alnum:]-]))/i", "<font color=silver...더보기 |
| |
| 스터디 < PHP |
|
<?php
define( 'wlen', 7);
list( $now_yy, $now_mm, $now_dd)=explode( '-', date('Y-m-d')); //echo $now_yy,$now_mm,$now_dd;
list( $wpos, $mlast)=explode( '-', date('w-t', mktime( 0, 0, 0, $now_mm, 1, $now_yy))); //mktime: any arguments thus omitted will be set to the current value according to the local date and time.
$wpos=(int)$wpo...더보기 |
| |
| 스터디 < PHP |
|
머리속에 갑자기 방법이 떠올라 가장 많이 쓰이는 jpg,gif,png,zip 만 해서 파일 확장자가 맞게 되어 있는지를 검사하는 함수를 만들어 보았습니다. 만일 스크립트 파일을 확장자를 이미지 확장자로 바꾼다할 지라도 유효성 검사에서 실패하겠죠.
function validate_ext($file, $ext="gif")
{
$ext = str...더보기 |
| |
| 스터디 < PHP |
|
// 년이 없다면 이번 년
if (!$year)
$year = date("Y");
// 달이 없다면 이번 달
if (!$month)
$month = date("m");
// 현재 $month 달의 일수 구하기
for ($i=1; $i<=32; $i++) {
$check = checkdate($month,$i,$year);
if (!$check) {
$day = $i - 1;
 ...더보기 |
| |
| 스터디 < PHP |
| function get_absolute_path($path) {
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
$absolutes = array();
foreach ($parts as $part) {
if ('.' == $part) continue;
if ('..' == $part) {...더보기 |
인사
환영해요!~ 김현석의 홈페이지 입니다^_^