当前位置: 首页>>代码示例>>PHP>>正文


PHP my_log函数代码示例

本文整理汇总了PHP中my_log函数的典型用法代码示例。如果您正苦于以下问题:PHP my_log函数的具体用法?PHP my_log怎么用?PHP my_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了my_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: read_url_write

function read_url_write($url, $save_dir, $key)
{
    if (empty($url) || empty($save_dir) || empty($key)) {
        return;
    }
    if (!is_dir($save_dir)) {
        mkdir($save_dir);
    }
    ini_set('memory_limit', '1000M');
    $sum = 0;
    for ($m = 1; $m < 26; $m++) {
        $start = $sum;
        $end = $sum + 1000;
        $sum = $end;
        $count = 0;
        if (!is_file($save_dir . $start . '-' . $end)) {
            my_log("START {$start}-{$end}");
            $handle = fopen("{$save_dir}{$start}-{$end}", 'wb');
            for ($i = $start; $i < $end; $i++) {
                $url_temp = $url . '?id=' . $i . '&username=xinhuaxuanwen&password=456789';
                $arr_str = @file_get_contents($url_temp);
                $arr_temp = json_decode($arr_str, true);
                if (@$arr_temp[$key]) {
                    fwrite($handle, $arr_str . ',');
                    $count++;
                }
            }
            my_log("HANDLE {$count}");
            fclose($handle);
            my_log("ENDED {$start}-{$end}");
        }
    }
}
开发者ID:pengzhengrong,项目名称:account,代码行数:33,代码来源:tourism_url_write.php

示例2: reg_abstract

function reg_abstract(&$ret_url)
{
    echo "<p>발표 정보를 등록합니다.</p>\n";
    $id = get_valid_id($_REQUEST["id"]);
    $when = get_valid_time($_REQUEST["when"]);
    $t = strtotime($when);
    $ret_url = "reg_abstract?id=" . $id . "&date=" . date('Y-m-d', $t);
    $talk_data = get_talk_data_or_gen($t, $id);
    $talk_data["title"] = $_REQUEST["title"];
    $talk_data["abstract"] = $_REQUEST["abstract"];
    $result1 = put_talk_data($t, $id, $talk_data);
    $result2 = true;
    if ($_FILES["memo"]["type"] === "application/pdf") {
        echo "<p>메모를 등록합니다.</p>\n";
        $memo_filename = gen_memo_filename($t, $id);
        $result2 = move_uploaded_file($_FILES["memo"]["tmp_name"], $memo_filename);
        if ($result2) {
            chmod($memo_filename, 0664);
            my_log(__FILE__, $memo_filename . " updated\n");
        } else {
            my_log(__FILE__, $memo_filename . " update failed\n");
        }
    }
    return $result1 && $result2;
}
开发者ID:skcho,项目名称:seminar,代码行数:25,代码来源:reg_run.php

示例3: perform

 public function perform()
 {
     my_log('/data/log/cronJob/doJob.log', '456');
     $time = $this->args['t'];
     $sets = $this->redis->getCronJob($time);
     my_log('/data/log/cronJob/doJob.log', $time);
     foreach ($sets as $row) {
         $job = unserialize($row);
         if (isset($job['m']) && isset($job['p']) && isset($job['c'])) {
             if (ParseCrontab::parse($job['p']) == true) {
                 $msg = $this->makeCmd($job['m'], $job['c']);
                 $res = $this->socket->send($msg);
                 if (!$res) {
                     $error = 'Cronjob ' . $time . ' ' . $row . ' send message error';
                     my_log('/data/log/cronJob/doJob.log', $error);
                 } else {
                     $error = 'Cronjob ' . $time . ' ' . $row . ' send message success';
                     my_log('/data/log/cronJob/doJob.log', $error);
                 }
             }
         } else {
             $error = 'Cronjob ' . $time . ' ' . $row . ' format error';
             my_log('/data/log/cronJob/doJob.log', $error);
         }
     }
 }
开发者ID:nosun,项目名称:php-resque-cronjob,代码行数:26,代码来源:SendCmd.php

示例4: listDir

/**
* listDir
* Método para obter todo o conteúdo de um diretorio, e
* que atendam ao critério indicado.
* @package        spoolga
* @name           listDir
* @version        2.0
* @author         Joao Paulo Bastos L. <jpbl.bastos at gmail dot com>
* @param          string $dir Diretorio a ser pesquisado
* @param          string $fileMatch Critério de seleção pode ser usados coringas como *-nfe.xml
* @param          boolean $retpath se true retorna o path completo dos arquivos se false so retorna o nome dos arquivos
* @return         mixed Matriz com os nome dos arquivos que atendem ao critério estabelecido ou false
*/
function listDir($dir, $fileMatch, $retpath = true)
{
    if (trim($fileMatch) != '' && trim($dir) != '') {
        //passar o padrão para minúsculas
        $fileMatch = strtolower($fileMatch);
        //cria um array limpo
        $aName = array();
        //guarda o diretorio atual
        $oldDir = getcwd() . DIRECTORY_SEPARATOR;
        //verifica se o parametro $dir define um diretorio real
        if (is_dir($dir)) {
            //mude para o novo diretorio
            chdir($dir);
            //pegue o diretorio
            $diretorio = getcwd() . DIRECTORY_SEPARATOR;
            if (strtolower($dir) != strtolower($diretorio)) {
                my_log("Motor Diz: OPS erro inesperado, Falha não há permissão de leitura no diretorio escolhido em " . date('Y-m-d H:i:s'), $logApp);
                return false;
            }
            //abra o diretório
            $ponteiro = opendir($diretorio);
            $x = 0;
            // monta os vetores com os itens encontrados na pasta
            while (false !== ($file = readdir($ponteiro))) {
                //procure se não for diretorio
                if ($file != "." && $file != "..") {
                    if (!is_dir($file)) {
                        $tfile = strtolower($file);
                        //é um arquivo então
                        //verifique se combina com o $fileMatch
                        if (fnmatch($fileMatch, $tfile)) {
                            if ($retpath) {
                                $aName[$x] = $dir . $file;
                            } else {
                                $aName[$x] = $file;
                            }
                            $x++;
                        }
                    }
                    //endif é diretorio
                }
                //endif é  . ou ..
            }
            //endwhile
            closedir($ponteiro);
            //volte para o diretorio anterior
            chdir($oldDir);
        }
        //endif do teste se é um diretorio
    }
    //endif
    return $aName;
}
开发者ID:jpblbastos,项目名称:scripts,代码行数:66,代码来源:functions.php

示例5: send_mail

function send_mail($mode, $from, $to, $subj, $msg)
{
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/' . $mode . '; charset=UTF-8' . "\r\n";
    $headers .= "From: =?UTF-8?B?" . base64_encode($from["name"]) . "?=" . " <" . $from["email"] . ">\r\n";
    $subj = "=?UTF-8?B?" . base64_encode($subj) . "?=";
    if (mail(implode(",", $to), $subj, $msg, $headers)) {
        my_log(__FILE__, "Succeed to send mail\n");
    } else {
        my_log(__FILE__, "Fail to send mail\n");
        exit(1);
    }
}
开发者ID:skcho,项目名称:seminar,代码行数:13,代码来源:send_mail.php

示例6: my_onClose

function my_onClose($serv, $fd, $from_id)
{
    my_log("Worker#{$serv->worker_pid} Client[{$fd}@{$from_id}]: fd={$fd} is closed");
    $buffer = G::getBuffer($fd);
    if ($buffer) {
        $buffer->clear();
    }
    if ($serv->exist($fd)) {
        echo 'FD[' . $fd . '] exist' . PHP_EOL;
    } else {
        echo 'FD[' . $fd . '] not exist' . PHP_EOL;
    }
}
开发者ID:liangkwok,项目名称:Swoole,代码行数:13,代码来源:exist.php

示例7: my_file_put_contents

function my_file_put_contents($filename, $data)
{
    $is_new = !file_exists($filename);
    if (file_put_contents($filename, $data) === false) {
        my_log(__FILE__, "{$filename} cannot be written\n");
        return false;
    } else {
        if ($is_new) {
            chmod($filename, 0664);
        }
        my_log(__FILE__, "{$filename} updated\n");
        return true;
    }
}
开发者ID:skcho,项目名称:seminar,代码行数:14,代码来源:file.php

示例8: __construct

 public function __construct()
 {
     parent::__construct();
     $this->load->library('auth_lib');
     if (!$this->auth_lib->is_valid_user()) {
         $email = $this->auth_lib->user()->email;
         $ip = $this->input->ip_address();
         my_log("User `{$email}` tried to login from {$ip}");
         $error_msg = 'You are not allowed to view this page.<br/>
         Contact Administrator.<br/>
         You can logout from <a href="' . base_url('logout') . '">here</a>';
         show_error($error_msg, 403, 'Permission Denied');
     }
 }
开发者ID:hharchani,项目名称:mail-merge-portal,代码行数:14,代码来源:Users.php

示例9: get_member

function get_member($id)
{
    $members = get_all_members();
    $members = array_filter($members, function ($member) use($id) {
        if ($id === $member["id"]) {
            return true;
        } else {
            return false;
        }
    });
    if (sizeof($members) === 1) {
        return array_pop($members);
    } else {
        my_log(__FILE__, "Member ID is invalid\n");
        exit(1);
    }
}
开发者ID:skcho,项目名称:seminar,代码行数:17,代码来源:read_data.php

示例10: run

 public function run()
 {
     $time = date('H_i', $this->start);
     // for test
     //$time = '13_18';
     $sets = $this->redis->getCronJob($time);
     if (!empty($sets)) {
         //            if(count($sets)>0){
         $res = $this->pushToQueue(array('t' => $time));
         if (empty($res)) {
             $error = 'Cronjob ' . $time . ' push fail';
             my_log('/data/log/cronJob/doJob.log', $error);
         } else {
             $error = 'Cronjob ' . $time . ' push ok, Id ' . $res;
             my_log('/data/log/cronJob/doJob.log', $error);
         }
         //            }
     }
 }
开发者ID:nosun,项目名称:php-resque-cronjob,代码行数:19,代码来源:CheckJob.php

示例11: gen_commenter

function gen_commenter($speakers)
{
    $all = array_map(function ($m) {
        return $m["id"];
    }, get_all_members());
    $listeners = array_filter($all, function ($id) use($speakers) {
        return !in_array($id, $speakers);
    });
    if (count($speakers) * 3 > count($listeners)) {
        my_log(__FILE__, "Listeners are too less compared to speakers\n");
        exit(1);
    }
    shuffle($listeners);
    $commenter_info = array();
    foreach ($speakers as $speaker) {
        $commenter_info[$speaker] = array_slice($listeners, 0, 3);
        $listeners = array_slice($listeners, 3);
    }
    return $commenter_info;
}
开发者ID:skcho,项目名称:seminar,代码行数:20,代码来源:commenter.php

示例12: my_onReceive

function my_onReceive(swoole_server $serv, $fd, $from_id, $data)
{
    my_log("Worker#{$serv->worker_pid} Client[{$fd}@{$from_id}]: received: {$data}");
    $cmd = trim($data);
    if ($cmd == "reload") {
        $serv->reload($serv);
    } elseif ($cmd == "task") {
        $task_id = $serv->task("hello world");
        echo "Dispath AsyncTask: id={$task_id}\n";
    } elseif ($cmd == "taskwait") {
        $result = $serv->taskwait("hello world", 2);
        echo "SyncTask: result={$result}\n";
    } elseif ($cmd == "hellotask") {
        $serv->task("hellotask");
    } elseif ($cmd == "close") {
        $serv->send($fd, "close connection\n");
        $result = $serv->close($fd);
    } elseif ($cmd == "info") {
        $info = $serv->connection_info($fd);
        $serv->send($fd, 'Info: ' . var_export($info, true) . PHP_EOL);
    } elseif ($cmd == "stats") {
        $serv_stats = $serv->stats();
        $serv->send($fd, 'Stats: ' . var_export($serv_stats, true) . PHP_EOL);
    } elseif ($cmd == "broadcast") {
        broadcast($serv, $fd, "hello from {$fd}\n");
    } elseif ($cmd == "error") {
        hello_no_exists();
    } elseif (substr($cmd, 0, 5) == "close") {
        $close_fd = substr($cmd, 6);
        $serv->close($close_fd);
    } elseif ($cmd == "shutdown") {
        $serv->shutdown();
    } else {
        $ret = $serv->send($fd, 'Swoole: ' . $data, $from_id);
        //var_dump($ret);
        //$serv->close($fd);
    }
    //echo "Client:Data. fd=$fd|from_id=$from_id|data=$data";
    //$serv->deltimer(800);
    //swoole_server_send($serv, $other_fd, "Server: $data", $other_from_id);
}
开发者ID:collinsmao,项目名称:swoole-src,代码行数:41,代码来源:server.php

示例13: returnXML

/** 
	Description: ;
	input: classname,$functionname,$errorcode, items
	return array
*/
function returnXML($arrArgs, $class_name, $function_name, $array_input, $obj = NULL)
{
    $count = count($arrArgs);
    $user = $arrArgs[$count - 2];
    if (strpos($obj->_MDB2->last_query, "sp_ServiceLogin") > 0) {
        my_log($user, 'INFO', $obj->_MDB2->last_query);
    }
    if ($obj->_MDB2_WRITE->last_query != "") {
        $kind = $class_name . "->" . $function_name;
        $detail = $obj->_MDB2_WRITE->last_query . " --> " . $error_code;
        my_log($user, 'ALL', $detail);
    }
    $result = "{urn:" . $class_name . "}" . $function_name . "Result";
    $array = "{urn:" . $class_name . "}" . $function_name . "Array";
    /*return new SOAP_Value('return', $result, array(
    		"error_code" => new SOAP_Value('error_code', 'string', $error_code), 
    			  "items"   => new SOAP_Value('items', $array, $items)
    			  )
    		 );*/
    return new SOAP_Value('return', $result, $array_input);
}
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:26,代码来源:common.php

示例14: upload


//.........这里部分代码省略.........
     if (!$form_validation_success) {
         echo json_encode($response);
         exit;
     }
     // Reading files to check the fields are proper.
     $this->load->library('excel_reader');
     // Marks file
     $marks = $this->excel_reader->read($files_data['marks']['full_path']);
     $marks_fields = array();
     foreach ($marks->get_fields() as $m_field) {
         $marks_fields[strtolower($m_field)] = $m_field;
     }
     // Email file
     $emails = $this->excel_reader->read($files_data['email']['full_path']);
     $e_fields = $emails->get_fields();
     $email_diff = array_diff(array('roll_no', 'father_email_id'), $e_fields);
     if (count($email_diff) > 0) {
         $response->email->success = false;
         $response->email->errors = 'Field ' . implode(', ', $email_diff) . ' not found in email file';
     }
     if (!$response->email->success) {
         echo json_encode($response);
         exit;
     }
     $email_fields = array();
     foreach ($e_fields as $e_field) {
         $email_fields[strtolower($e_field)] = $e_field;
     }
     // Everything seems fine now. Creating task to start sending emails
     $this->load->model('task');
     $task = $this->task->create_task($this->auth_lib->user()->email, $this->input->ip_address(), $current_time);
     $task_id = $task->id;
     $this->load->library('session');
     $this->session->set_userdata('task_id', $task_id);
     $response->task_id = $task_id;
     // send response with task_id and start background processing
     $this->load->library('bg_processing');
     $this->bg_processing->send_and_close(json_encode($response));
     $this->task->set_task_status($task_id, 'processing');
     // Renaming uploaded files
     foreach ($files_data as $file_name => $data) {
         $new_name = $file_name . '_file_for_task_' . $task_id . $data['file_ext'];
         $new_full_path = $data['file_path'] . $new_name;
         rename($data['full_path'], $new_full_path);
         $data['file_name'] = $new_name;
         $files_data[$file_name]['full_path'] = $new_full_path;
     }
     $this->load->model('student');
     $this->load->model('course');
     $months = array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec');
     $months_available = array();
     foreach ($months as $month) {
         if (in_array($month . '-classes', array_keys($marks_fields))) {
             $months_available[] = $month;
         }
     }
     $CI = $this;
     $CI->task->insert_status_msg($task_id, "Info: Started reading marks file");
     $marks->each(function ($a) use($task_id, $months_available, $marks_fields, $CI) {
         if (!$a->roll_no) {
             return;
         }
         $student = $CI->student->get_or_create($a->roll_no, $a->name, null, $a->SGPA);
         $course_id = $CI->course->get_or_create($a->course_code, $a->course_name, $a->credits);
         $classes_total = 0;
         $classes_missed = 0;
         foreach ($months_available as $month) {
             $classes_total += $a->get($marks_fields[$month . '-classes']);
             $classes_missed += $a->get($marks_fields[$month . '-absents']);
         }
         $CI->course->insert_marks_info(array('task_id' => $task_id, 'student_id' => $student->id, 'course_id' => $course_id, 'max_marks' => $a->get('max-marks'), 'marks_secured' => $a->get('marks-obtained'), 'classes_total' => $classes_total, 'classes_missed' => $classes_missed, 'grade' => $a->get('Grade')));
     });
     $CI->task->insert_status_msg($task_id, "Info: End reading marks file");
     $this->load->library('email_wrapper');
     $CI->task->insert_status_msg($task_id, "Info: Started sending emails");
     $emails->each(function ($a) use($task, $CI) {
         if (!$a->roll_no || !$a->father_email_id) {
             return;
         }
         $task_id = $task->id;
         $student = $CI->student->get_or_create($a->roll_no, null, $a->father_email_id);
         $course_data = $CI->course->get_data($task_id, $student->id);
         if (count($course_data)) {
             my_log($student->parent_email . ' - ' . count($course_data));
             $email_success = $CI->email_wrapper->send($student, $course_data, $task);
             if ($email_success) {
                 $CI->task->increase_sent_email($task_id);
                 my_log("Task {$task_id}: Success: Email to {$student->parent_email} sent successfully");
                 $CI->task->insert_status_msg($task_id, "Success: Email to {$student->parent_email} sent successfully");
             } else {
                 $CI->task->increase_failed_email($task_id);
                 $CI->task->insert_status_msg($task_id, "Warning: Email to {$student->parent_email} failed");
             }
         } else {
             $CI->task->insert_status_msg($task_id, "Info: No marks or attendance found for student with roll_no {$student->roll_no}");
         }
     });
     $CI->task->insert_status_msg($task_id, "Info: Completed sending emails");
     $this->task->complete($task_id, date('Y-m-d H:i:s'));
 }
开发者ID:hharchani,项目名称:mail-merge-portal,代码行数:101,代码来源:Main.php

示例15: snts_n_days_later

function snts_n_days_later($n)
{
    if ($n <= 0) {
        my_log(__FILE__, "n should be bigger than 0\n");
        exit(1);
    }
    $is_n_days_later = function ($snt) use($n) {
        $n_days_later = strtotime("+{$n} day");
        if ((int) date('Y', $n_days_later) === $snt["when"]["year"] && (int) date('m', $n_days_later) === $snt["when"]["month"] && (int) date('d', $n_days_later) === $snt["when"]["day"]) {
            return true;
        } else {
            return false;
        }
    };
    return array_filter(get_schedule(), $is_n_days_later);
}
开发者ID:skcho,项目名称:seminar,代码行数:16,代码来源:schedule.php


注:本文中的my_log函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。