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


PHP system_log函数代码示例

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


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

示例1: socketServer

 public function socketServer($input)
 {
     //system_log($_SERVER);
     if ($input['key'] !== API_KEY) {
         return array('error' => 401);
     }
     $command = strtolower(trim($input['command']));
     $available_commands = array('start', 'stop');
     if (!in_array($command, $available_commands)) {
         return array('error' => 400);
     }
     $null = NULL;
     //null var
     switch ($command) {
         case 'start':
             //Create TCP/IP sream socket
             $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
             //reuseable port
             socket_set_option($this->socket, SOL_SOCKET, SO_REUSEADDR, 1);
             //bind socket to specified host
             socket_bind($this->socket, 0, $this->port);
             //listen to port
             socket_listen($this->socket);
             $this->client = array($this->socket);
             $count = 0;
             $file = fopen($this->flag_file, 'w');
             fwrite($file, '');
             fclose($file);
             while (true) {
                 $count++;
                 sleep(1);
                 if (file_exists($this->flag_file) && file_get_contents($this->flag_file)) {
                     system_log('socket close');
                     die('Server Closed');
                 }
                 $changed = $this->client;
                 socket_select($changed, $null, $null, 0, 10);
                 if (in_array($this->socket, $changed)) {
                 }
             }
             // Infinite While Over
             socket_close($this->socket);
             return array('socketStatus' => 'running');
             break;
         case 'stop':
             $file = fopen($this->flag_file, 'w');
             fwrite($file, '1');
             sleep(2);
             fwrite($file, '');
             fclose($file);
             return array('socketStatus' => 'stoped');
             break;
     }
 }
开发者ID:dhaval-parekh,项目名称:dhaval-test,代码行数:54,代码来源:socket.php

示例2: editSubjectAction

 public function editSubjectAction()
 {
     $mj_id = (int) I('post.id');
     $su_id = (int) I('post.subject');
     $sub_id = (int) I('post.sub');
     if (!$mj_id || !$su_id || !$sub_id) {
         $this->error('参数错误,请重试~');
     }
     $sql1 = 'update app_university_major set su_id = "' . $su_id . '", sub_id ="' . $sub_id . '" where id = "' . $mj_id . '";';
     $sql2 = 'update app_university_majorlang set su_id = "' . $su_id . '", sub_id ="' . $sub_id . '" where fid = "' . $mj_id . '";';
     $sql3 = 'update app_university_major_course set su_id = "' . $su_id . '", sub_id ="' . $sub_id . '" where mj_id = "' . $mj_id . '";';
     $sql4 = 'update app_university_major_courselang set su_id = "' . $su_id . '", sub_id ="' . $sub_id . '" where mj_id = "' . $mj_id . '";';
     $data = ['mj_id' => $mj_id, 'su_id' => $su_id, 'sub_id' => $sub_id];
     $mModel = M('university_major');
     $old_data = $mModel->field('id as mj_id, su_id, sub_id')->where(['id' => $mj_id])->find();
     $model = M();
     $model->startTrans();
     $res1 = $model->execute($sql1);
     $res2 = $model->execute($sql2);
     $res3 = $model->execute($sql3);
     $res4 = $model->execute($sql4);
     if ($res1 === false || $res2 === false || $res3 === false || $res4 === false) {
         $model->rollback();
         $this->error('修改失败,请重试');
     } else {
         $model->commit();
         $mark = session('adminUser') . '在 ' . date('Y-m-d H:i:s') . ', 修改了专业分类, 专业ID为:' . $mj_id;
         system_log($mark, $mModel->getTablename(), $mj_id, 'e', $data, $old_data, 0);
         $this->success('修改成功', U('AlyAdmin/Major/editSubject'));
     }
 }
开发者ID:anLl,项目名称:Apply2,代码行数:31,代码来源:MajorController.class.php

示例3: system_log_listener

/**
 * System log listener.
 * This function listens to all events in the system and logs anything appropriate.
 *
 * @param String $event
 * @param String $object_type
 * @param mixed $object
 */
function system_log_listener($event, $object_type, $object)
{
    system_log($object, $event);
    return true;
}
开发者ID:eokyere,项目名称:elgg,代码行数:13,代码来源:system_log.php

示例4: active

 public function active()
 {
     if ($_GET) {
         $data = self::getParam($_GET);
         $userModel = M('user');
         $is_active = $userModel->field('username,is_active')->where("id={$data['uid']}")->find();
         if ($is_active['is_active'] == '0') {
             $flag = $userModel->where("id={$data['uid']}")->save(array('is_active' => 2));
             if ($flag !== false) {
                 system_log(session('username') . "在" . date('Y-m-d H:i:s') . "激活了中介" . $is_active['username'], 'app_user', $data['uid'], 'e', array('is_active' => 0), array('is_active' => 2), 1);
                 echo json_encode(array('msg' => 'This sub-account has been activated', 'active' => 2));
             }
         } else {
             $flag = $userModel->where("id={$data['uid']}")->save(array('is_active' => 0));
             if ($flag !== false) {
                 system_log(session('username') . "在" . date('Y-m-d H:i:s') . "取消激活中介" . $is_active['username'], 'app_user', $data['uid'], 'e', array('is_active' => 2), array('is_active' => 0), 1);
                 echo json_encode(array('msg' => 'This sub-account has been deactivated', 'active' => 0));
             }
         }
     }
 }
开发者ID:anLl,项目名称:Apply2,代码行数:21,代码来源:AccoutController.class.php

示例5: delPic

 public function delPic()
 {
     if ($_GET) {
         $id = $_GET['id'];
         $picModel = M('university_pic');
         $originData = $picModel->alias('a')->field('*')->where("id={$id}")->find();
         $picModel->startTrans();
         $flag = $picModel->where("id={$id}")->delete();
         $picInfoModel = M('university_piclang');
         $flag1 = $picInfoModel->where("fid={$id}")->delete();
         if ($flag !== false && $flag1 !== false) {
             $picModel->commit();
             system_log(session('adminUser') . "在" . date('Y-m-d H:i:s') . "删除了学校图片信息", $picModel->getTableName(), $id, 'a', $_POST, $originData, 0);
             $this->success('删除成功');
         } else {
             $picModel->rollback();
             $this->success('删除失败');
         }
     }
 }
开发者ID:anLl,项目名称:Apply2,代码行数:20,代码来源:SchoolController.class.php

示例6: addStep4Action

 /**
  * 添加学生 第 4 步提交处理.
  * 
  * @access public
  * @return void
  * @author Liuping <xiaofengwz@163.com>
  */
 public function addStep4Action()
 {
     // 校验一级中介是否有权限添加学生
     if (!AgentAuth::checkTopAgentOfStu()) {
         $this->error('No permission');
     }
     // 当前操作, 参见第 1 步中说明.
     $operFlag = intval(I('post.oper', 1));
     $studentId = intval(I('post.currStudent', 0));
     // 学生 id
     if (empty($studentId)) {
         $this->error('Invalid parameters');
     }
     // 实例化模型
     $model = new MemberStuModel();
     $stuInfo = $model->fetchStuInfo($studentId);
     if (empty($stuInfo)) {
         $this->error('Invalid parameters');
     }
     // 对学生做权限验证
     $res = AgentAuth::checkStu($studentId, [AgentAuth::WRITE]);
     if (9 !== $res['status']) {
         $this->error('No permission');
     }
     // 验证成功规则能过, 验证是否有添加学生的权限
     // 校验一级中介是否有权限添加学生
     if (!AgentAuth::checkTopAgentOfStu($stuInfo['uid'])) {
         $this->error('No permission');
     }
     $post = I('post.');
     $files = $_FILES;
     // js 上传无效时, PHP做上传兼容处理, 仅在为空时才处理
     /*
     foreach($post as $k => & $v) {
         if(empty($v)) {
             $_f = isset($files[$k]) ? $files[$k] : [];
             if(empty($_f)) { // 没有上传文件
                 $v = '';
             } else {
                 $info = $this->procStuAttaUploadFile([$_f]);
                 if(0 === $info['status']) { // 上传失败
                     $v = '';
                 } else { // 上传成功
                     $v = $info['data']['src'];
                 }
             }
         }
     }
     unset($v);
     */
     // 设置并补齐默认数据
     if (empty($post['id'])) {
         $post['create_time'] = time();
     }
     $uid = $stuInfo['uid'];
     $ano = '';
     $post['uid'] = $uid;
     $post['fuid'] = $stuInfo['fuid'];
     $post['partid'] = $stuInfo['partid'];
     $post['s_id'] = $studentId;
     $post['a_no'] = $ano;
     // 执行验证
     // 若有上传学位证, 必须有毕业证附近
     $attDegreeCert = $post['degree_certificate'];
     if (!empty($attDegreeCert)) {
         $attDiploma = $post['diploma'];
         if (empty($attDiploma)) {
             $this->error('Please upload graduation certificate');
         }
     }
     // 必填项验证
     $res = $model->validate($model->uploadInfoRules)->create($post);
     if (!$res) {
         $this->error($model->getError());
     }
     // 验证通过
     $res = $model->procUploadInfo($post, $uid, $studentId, $ano);
     // 处理成功跳转到 lists 列表页面
     if ($res) {
         // 写入完整标志
         $res1 = $model->switchCompleteStatus($studentId, 1);
         if ($res1) {
             // 更新区域 id
             $model->updateStuArea($studentId);
             // 写入系统日志
             $_mark = session('username') . '在' . date('Y-m-d H:i:s') . ', 添加了一个学生, 学生姓名: ' . $stuInfo['first_name'] . $stuInfo['family_name'];
             if (1 === $operFlag) {
                 // 写入新增日志
                 system_log($_mark, $model->getTableName(), $studentId, 'a', $stuInfo, NULL, 1);
             }
             //$this->success('Successful!', U('noApplyStudentlist'));
             $this->success('Successful!', U('studentDetail', ['id' => $studentId]));
         } else {
//.........这里部分代码省略.........
开发者ID:anLl,项目名称:Apply2,代码行数:101,代码来源:StudentController.class.php

示例7: socket_create

$port = 5352;
// create Socket
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
// Bind Socket
$result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n");
$result = socket_listen($socket, 3) or die("Could not set up socket listener\n");
$spawn = socket_accept($socket) or die("Could not accept incoming connection\n");
//while(true){
// Read Input form Client message
$input = socket_read($spawn, 2048) or die("Could not read input\n");
if ($input == "1") {
    $input = "Socket Closed";
    system_log($input);
    socket_close($spawn);
    socket_close($socket);
    return true;
}
$output = strrev($input) . "\n";
// Send Message to client
socket_write($spawn, $output, strlen($output)) or die("Could not write output\n");
system_log($input);
//}
var_dump($socket);
var_dump($result);
var_dump($spawn);
socket_close($spawn);
socket_close($socket);
?>
</body>
</html>
开发者ID:dhaval-parekh,项目名称:dhaval-test,代码行数:30,代码来源:server.php

示例8: saveUpfiles

 /**
  * @保存上传的文件地址
  * @Editer:段涛
  * @Function Name:saveUpfiles
  */
 public function saveUpfiles()
 {
     if (IS_AJAX) {
         $data = I('post.');
         $find = M('member_upload')->where(array('s_id' => $data['sid'], 'a_no' => ''))->getField('id');
         $result['status'] = false;
         //初始状态
         if ($find) {
             $success = M('member_upload')->where(array('id' => $find))->save($data);
             if ($success !== false) {
                 $result['status'] = true;
                 system_log(session('adminUser') . "在" . date('Y-m-d H:i:s') . "修改学生个人基本上传文件,学生ID" . $data['sid'], 'member_upload', 's_id', 'e', $data, $find, 0);
             }
         } else {
             $result['error'] = "Can't find user information";
         }
         $result['status'] = true;
         $this->ajaxReturn($result, 'json');
     }
 }
开发者ID:anLl,项目名称:Apply2,代码行数:25,代码来源:StudentController.class.php

示例9: startServices

 public function startServices()
 {
     //echo 'Enter '.__FUNCTION__.'=========================== '.time().' <br>'.PHP_EOL;
     $this->socket = socket_create(AF_INET, SOCK_STREAM, 0) or $this->handle_error("Could not create socket");
     $result = socket_bind($this->socket, $this->host, $this->port) or $this->handle_error("Could not bind to socket");
     $count = 0;
     system_log('=================================================================');
     system_log('Start => ' . $this->phone . ' => ' . date('Y-m-d H:i:s'));
     while (true) {
         $input = false;
         $result = socket_listen($this->socket, 3) or $this->handle_error("Could not set up socket listener");
         $spawn = socket_accept($this->socket) or $this->handle_error("Could not accept incoming connection");
         $input = socket_read($spawn, 100000) or $this->handle_error("Could not read input");
         $response = array('status' => 201);
         if (!($input && !empty($input) && is_array(json_decode($input, true)))) {
         }
         $input = json_decode($input, true);
         system_log($input);
         $count++;
         if (!(isset($input['command']) && !empty($input['command']))) {
             $input['command'] = false;
         }
         $valid_flag = false;
         $command = trim(strtolower($input['command']));
         $log = $this->name . ' => ' . $this->port . ' => ' . $count . ' => ' . $input['command'];
         system_log($log);
         //echo $command.PHP_EOL;
         switch ($command) {
             case 'login':
                 $payload = $this->login();
                 $valid_flag = true;
                 break;
             case 'logout':
                 $payload = $this->logout();
                 if ($payload) {
                     $valid_flag = true;
                 }
                 break;
             case 'die':
                 $payload = $this->logout();
                 die('Die');
                 break;
             case 'type':
                 $payload = self::$whatsapp->sendMessageComposing($input['to']);
                 $valid_flag = true;
                 break;
             case 'pause':
                 $payload = self::$whatsapp->sendMessagePaused($input['to']);
                 $valid_flag = true;
                 break;
             case 'send':
                 $payload = $this->sendMessage($input['to'], $input['message'], $input['messagetype']);
                 $valid_flag = true;
                 break;
             case 'sync':
                 $contacts = $input['contacts'];
                 $contacts = array_unique($contacts);
                 $payload = $this->sendSync($contacts);
                 $valid_flag = true;
                 break;
             case 'poll':
                 while (self::$whatsapp->pollMessage()) {
                 }
                 $payload = true;
                 $valid_flag = true;
                 break;
             case 'ping':
             default:
                 $payload = self::$whatsapp->sendPing();
                 $valid_flag = true;
                 break;
         }
         if ($valid_flag) {
             $response['status'] = 200;
             $response['message'] = 'ok';
             $response['payload'] = isset($payload) ? $payload : true;
             system_log($response);
             //$response = isset($payload)?$payload:true;
             if (isset($payload)) {
                 if (!(is_array($payload) || is_object($payload))) {
                     $payload = mysql_real_escape_string($payload);
                 }
                 $response = $payload;
             } else {
                 $response = true;
             }
             $output = json_encode($response);
             socket_write($spawn, $output, strlen($output)) or $this->handle_error("Could not write output");
             if ($command == 'logout') {
                 sleep(1);
                 break;
             }
         }
         socket_close($spawn);
         $valid_flag = false;
     }
     // while close
     system_log('Stop => ' . $this->phone . ' => ' . date('Y-m-d H:i:s'));
     system_log('=================================================================');
     socket_close($this->socket);
//.........这里部分代码省略.........
开发者ID:dhaval-parekh,项目名称:dhaval-test,代码行数:101,代码来源:code.php

示例10: test_log

function test_log($log)
{
    system_log($log);
}
开发者ID:dhaval-parekh,项目名称:dhaval-test,代码行数:4,代码来源:log.php

示例11: ajaxChgEmail

 public function ajaxChgEmail()
 {
     $sid = I('get.sid');
     $email = I('get.email');
     $pwd = I('get.pwd');
     $res = '';
     if (empty($email) || empty($pwd)) {
         $res = false;
         $this->ajaxReturn($res, "json");
     }
     $model = M('member_stu');
     $data = ['ao_email' => $email, 'ao_email_pwd' => $pwd];
     $old_data = $model->where(['id' => $sid])->find();
     $result = $model->where(['id' => $sid])->save($data);
     if ($result !== false) {
         //写入日志系统
         $mark = session('adminUser') . '在 ' . date('Y-m-d H:i:s') . ',批量给学生id为' . $sid . '的学生,修改邮箱:' . $data['ao_email'] . ', 密码为:' . $data['ao_email_pwd'];
         system_log($mark, $model->getTableName(), $sid, 'e', $data, $old_data, 0);
         $res = true;
     } else {
         $res = false;
     }
     $this->ajaxReturn($res, "json");
 }
开发者ID:anLl,项目名称:Apply2,代码行数:24,代码来源:AoManageController.class.php

示例12: pleio_api_handle_push_queue

function pleio_api_handle_push_queue()
{
    $site_guid = get_config("site_id");
    if ($site_guid == 1) {
        // pleio.nl only, handles all subsites
        $max_messages = 300;
        set_time_limit(59);
        elgg_set_ignore_access(1);
        $messages = elgg_get_entities(array('types' => 'object', 'subtypes' => 'push_message_queue', 'site_guid' => ELGG_ENTITIES_ANY_VALUE, 'order_by' => 'e.time_created asc', 'limit' => $max_messages));
        $apnsMessages = array();
        $gcmMessages = array();
        if ($messages) {
            foreach ($messages as $message) {
                if ($message->river_id) {
                    list($apnsMessages, $gcmMessages) = pleio_api_push_handle_river_id($message->river_id, $apnsMessages, $gcmMessages);
                } else {
                    list($apnsMessages, $gcmMessages) = pleio_api_push_handle_message_to($message, $apnsMessages, $gcmMessages);
                }
                system_log($message, 'handled apns:' . sizeof($apnsMessages) . ' gcm:' . sizeof($gcmMessages));
                $message->delete();
            }
        }
        if (sizeof($apnsMessages)) {
            pleio_api_push_apns_messages($apnsMessages);
        }
        if (sizeof($gcmMessages)) {
            pleio_api_push_gcm_messages($gcmMessages);
        }
        elgg_set_ignore_access(0);
        return sizeof($apnsMessages) + sizeof($gcmMessages);
    }
}
开发者ID:appstaat,项目名称:pleio_api,代码行数:32,代码来源:helpers.php

示例13: mkdir

 *	Company Url : 
 *	Description: index file of application
 *
 *
 *
 *
 *
 */
require_once 'config/config.php';
require_once 'config/route.php';
// Create Upload Directory if Not Exist
if (!is_dir(UPLOAD_DIR)) {
    mkdir(UPLOAD_DIR, 0777);
}
if (php_sapi_name() == 'cli') {
    system_log('cli execute');
    $ControllerFile = DIR_CONTROLLER . DS . 'socket.php';
    require_once $ControllerFile;
    $Controller = new Socket();
    $input = array();
    $input['key'] = 'app_secreat_key';
    $input['command'] = $argv[1];
    $response = $Controller->socketServer($input);
    die(json_encode($response));
}
$GET = array();
$GET[0] = $Url->getUrlSegment(0);
//$GET = explode('/',$GET);
$isApiRequest = isset($GET[0]) && strtolower($GET[0]) == 'api' ? true : false;
//$isAdmin = isset($GET[0])&&strtolower($GET[0])=='admin'?true:false;
if ($isApiRequest) {
开发者ID:dhaval-parekh,项目名称:dhaval-test,代码行数:31,代码来源:index.php

示例14: addCollegeAction

 /**
  * 添加学院提交处理
  *
  * @access public
  * @return void
  * @author Liuping <xiaofengwz@163.com>
  */
 public function addCollegeAction()
 {
     // 主表 university_college 数据
     $us_id = intval(I('post.us_id'));
     $data = array();
     $data['us_id'] = $us_id;
     $data['post_code'] = I('post.post_code');
     $data['link'] = I('post.link');
     $data['is_del'] = 0;
     // 返回给客户端的结果, 1: 成功, 0: 失败, 仅限 ajax
     $result = 1;
     $model = M('UniversityCollege');
     // 开启事务
     $model->startTrans();
     if (FALSE !== $model->add($data)) {
         $lastId = $model->getLastInsID();
         // 从表 university_collegelang 数据
         $detailData = array();
         $postMultiLang = I('post.multi');
         // 组装从表数据
         foreach ($postMultiLang as $lang => $postRow) {
             $row['fid'] = $lastId;
             $row['us_id'] = $us_id;
             $row['lang'] = $lang;
             $row['col_name'] = $postRow['col_name'];
             $row['addr'] = $postRow['addr'];
             $row['introduction'] = $postRow['introduction'];
             $row['is_del'] = 0;
             $detailData[] = $row;
         }
         // 写入从表成功, 提交事务
         $detailModel = M('UniversityCollegelang');
         if (FALSE !== $detailModel->addAll($detailData)) {
             $model->commit();
             // 写入系统日志
             $_mark = session('adminUser') . '在' . date('Y-m-d H:i:s') . ', 添加了学院 : 学校 id : ' . $us_id;
             system_log($_mark, $model->getTableName(), $lastId, 'a', $detailData, NULL, 0);
         } else {
             $model->rollback();
             $result = 0;
         }
     } else {
         $model->rollback();
         $result = 0;
     }
     if (IS_AJAX) {
         $this->ajaxReturn(array('status' => $result));
     } elseif ($result) {
         $this->success("添加学院成功", U('index'));
     } else {
         $this->error('添加学院失败');
     }
 }
开发者ID:anLl,项目名称:Apply2,代码行数:60,代码来源:CollegeController.class.php

示例15: die

 if (file_exists($flag_file) && file_get_contents($flag_file)) {
     die('Server Closed');
 }
 $changed = $clients;
 //print_r(PHP_EOL);
 socket_select($changed, $null, $null, 0, 10);
 //print_r(PHP_EOL);
 //print_r($changed);
 if (in_array($socket, $changed)) {
     $socket_new = socket_accept($socket);
     // accpet new socket
     $clients[] = $socket_new;
     // add socket to client array
     $header = socket_read($socket_new, 2048);
     //read data sent by the socket
     system_log($header);
     perform_handshaking($header, $socket_new, $host, $port);
     //perform websocket handshake
     socket_getpeername($socket_new, $ip);
     //get ip address of connected socket
     $response = array('type' => 'system', 'message' => $ip . ' connected');
     $response = mask(json_encode($response));
     //prepare json data
     //print_r($socket_new); // new connection of client
     send_message($response);
     //notify all users about new connection
     //make room for new socket
     $found_socket = array_search($socket, $changed);
     //print_r(PHP_EOL);
     //print_r($found_socket);
     unset($changed[$found_socket]);
开发者ID:dhaval-parekh,项目名称:dhaval-test,代码行数:31,代码来源:socket.php


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