$test = substr("abcdefghijklmn", 0, 13) ;
echo $test."...";
'웹 > php' 카테고리의 다른 글
코드이그나이터 index.php 없애기 (0) | 2016.05.23 |
---|---|
php 파일 읽기 (0) | 2016.04.25 |
session 유지하는 법 (0) | 2016.04.25 |
php 파일 업로드 (0) | 2016.03.30 |
php curl 사용 예제 (0) | 2016.03.30 |
$test = substr("abcdefghijklmn", 0, 13) ;
echo $test."...";
코드이그나이터 index.php 없애기 (0) | 2016.05.23 |
---|---|
php 파일 읽기 (0) | 2016.04.25 |
session 유지하는 법 (0) | 2016.04.25 |
php 파일 업로드 (0) | 2016.03.30 |
php curl 사용 예제 (0) | 2016.03.30 |
$dirRoot = $_SERVER["DOCUMENT_ROOT"];
$file_date_dir = "test";
$current = date("Y-m-d", time());
$fmt_time = strtotime($current);
if(is_dir($dirRoot."/admin/uploads/".$file_date_dir)){
}else{
@mkdir($dirRoot."/test/uploads/".$file_date_dir, 0777);
}
// uploads디렉토리에 파일을 업로드합니다.
$uploaddir = '../uploads/'.$file_date_dir."/";
$uploadfile = $uploaddir ."test_". $fmt_time.".jpg";
if($_POST['MAX_FILE_SIZE'] < $_FILES['brand_img']['size']){
// echo "업로드 파일이 지정된 파일크기보다 큽니다.\n";
} else {
if(($_FILES['brand_img']['error'] > 0) || ($_FILES['brand_img']['size'] <= 0)){
// echo "파일 업로드에 실패하였습니다.";
} else {
// HTTP post로 전송된 것인지 체크합니다.
if(!is_uploaded_file($_FILES['brand_img']['tmp_name'])) {
//echo "HTTP로 전송된 파일이 아닙니다.";
} else {
// move_uploaded_file은 임시 저장되어 있는 파일을 ./uploads 디렉토리로 이동합니다.
if (move_uploaded_file($_FILES['brand_img']['tmp_name'], $uploadfile)) {
// echo "성공적으로 업로드 되었습니다.\n";
} else {
// echo "파일 업로드 실패입니다.\n";
}
}
}
}
코드이그나이터 index.php 없애기 (0) | 2016.05.23 |
---|---|
php 파일 읽기 (0) | 2016.04.25 |
session 유지하는 법 (0) | 2016.04.25 |
텍스트 글짜 한정 (0) | 2016.03.30 |
php curl 사용 예제 (0) | 2016.03.30 |
$db_Name= "데이터베이스";
$db_User= "유저";
$db_Pass="비밀번호";
$sql_ip="xxx.xxx.xxx.xxx";
$connect = mysql_connect($sql_ip, $db_User, $db_Pass);
$connect2 = mysql_connect($sql_ip, $db_User, $db_Pass);
mysql_select_db("데이터베이스", $connect);
$gcm_sql = " select * from test";
$gcm_result = mysql_query($gcm_sql, $connect);
$gcm_row = mysql_num_rows($gcm_result);
while($gcm_row = mysql_fetch_array($gcm_result, MYSQL_ASSOC))
{
if ($gcm_row[push_status] ==1)
{
$headers = array(
'Content-Type:application/json',
'Authorization:key=키값 입력하는 곳'
);
$arr = array();
$arr['data'] = array();
$arr['data']['msg'] = $img;
$arr['data']['con_idx'] = $idx;
$arr['data']['type'] = $type;
$arr['registration_ids'] = array();
$arr['registration_ids'][0] = $gcm_row[mem_gcm_id];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($arr));
$response = curl_exec($ch);
curl_close($ch);
}
}
코드이그나이터 index.php 없애기 (0) | 2016.05.23 |
---|---|
php 파일 읽기 (0) | 2016.04.25 |
session 유지하는 법 (0) | 2016.04.25 |
텍스트 글짜 한정 (0) | 2016.03.30 |
php 파일 업로드 (0) | 2016.03.30 |