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


PHP Core::debug方法代码示例

本文整理汇总了PHP中Core::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::debug方法的具体用法?PHP Core::debug怎么用?PHP Core::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core的用法示例。


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

示例1: debugAndLayout

 public static function debugAndLayout()
 {
     if (!self::hasDebug()) {
         return;
     }
     Core::$debug = true;
     View::$layout = true;
 }
开发者ID:jjechev,项目名称:phpTdConvert,代码行数:8,代码来源:DebugController.php

示例2: __construct

 public function __construct($vars = null)
 {
     // This part only needs to be run once
     if (null === Session::$instance) {
         // Load config
         Session::$config = Core::config('session');
         if (!isset(Session::$config['check_string']) || !Session::$config['check_string']) {
             Session::$config['check_string'] = '&$@de23#$%@.d3l-3=!#1';
         }
         if (!isset(Session::$config['name']) || !preg_match('#^(?=.*[a-z])[a-z0-9_]++$#iD', Session::$config['name'])) {
             // Name the session, this will also be the name of the cookie
             Session::$config['name'] = 'PHPSESSINID';
         }
         if (IS_DEBUG) {
             $time = microtime(1);
             $is_debug = (bool) Core::debug()->profiler()->is_open();
             if ($is_debug) {
                 Core::debug()->profiler()->start('Core', 'Session StartTime');
             }
         }
         if (isset(Session::$config['driver']) && class_exists('Session_Driver_' . Session::$config['driver'], true)) {
             $driver_name = 'Session_Driver_' . Session::$config['driver'];
             if (isset(Session::$config['driver_config'])) {
                 Session::$driver = new $driver_name(Session::$config['driver_config']);
             } else {
                 Session::$driver = new $driver_name();
             }
         } else {
             Session::$driver = new Session_Driver_Default();
         }
         if (!isset(Session::$config['type']) || Session::$config['type'] != 'url') {
             Session::$config['type'] = 'cookie';
         }
         if (IS_DEBUG) {
             if ($is_debug) {
                 Core::debug()->profiler()->stop();
             }
             # 输出Session启动使用时间
             Core::debug()->info(microtime(1) - $time, 'Session start use time');
         }
         if ($vars) {
             $this->set($vars);
         }
         if (!isset($_SESSION['_flash_session_'])) {
             $_SESSION['_flash_session_'] = array();
         }
         Session::$flash =& $_SESSION['_flash_session_'];
         # 清理Flash Session
         $this->expire_flash();
         $_SESSION['SID'] = Session::$driver->session_id();
         # 确保关闭前执行保存
         Core::register_shutdown_function(array('Session', 'write_close'));
         Session::$instance = $this;
         # 加载用户数据
         Session::load_member_data();
     }
 }
开发者ID:google2013,项目名称:myqee-1,代码行数:57,代码来源:session.class.php

示例3: delete

 /**
  * 删除指定key的缓存,若$key===true则表示删除全部
  *
  * @param string $key
  */
 public function delete($key)
 {
     if (IS_DEBUG) {
         Core::debug()->info($key, 'apc cache delete key');
     }
     if ($key === true) {
         return $this->delete_all();
     }
     return apc_delete($key);
 }
开发者ID:google2013,项目名称:myqeecms,代码行数:15,代码来源:Apc.class.php

示例4: find

 /**
  * 获取数据
  *
  * @param $query SQL OR Query_Builder
  * @return \OOP\ORM\Result
  */
 public function find($query = null)
 {
     if (\is_array($query)) {
         $query = \http_build_query($query, '', '&');
     }
     $url = $this->api_url . (\strpos($this->api_url, '?') !== false ? '?' : '&') . $query;
     try {
         $data = (string) $this->driver()->get($url);
     } catch (\Exception $e) {
         \Core::debug()->error('ORM获取数据失败,URL:' . $url);
         $data = '[]';
     }
     $this->last_query = $url;
     $data = @\json_decode($data, true);
     return $this->create_group_data($data, true);
 }
开发者ID:google2013,项目名称:myqee,代码行数:22,代码来源:rest.class.php

示例5: set

 /**
  * 存数据
  *
  * @param string/array $key 支持多存
  * @param $data Value 多存时此项可空
  * @param $lifetime 有效期,默认3600,即1小时,0表示最大值30天(2592000)
  * @return boolean
  */
 public function set($key, $value = null, $lifetime = 3600)
 {
     \Core::debug()->info($key, 'apc cache set key');
     if (\is_array($key)) {
         $return = true;
         foreach ($key as $k => &$v) {
             static::_format_data($v);
             $s = \apc_store($k, $v, $lifetime);
             if (false === $s) {
                 $return = false;
             }
         }
         return $return;
     } else {
         static::_format_data($value);
         return \apc_store($key, $value, $lifetime);
     }
 }
开发者ID:google2013,项目名称:myqee,代码行数:26,代码来源:apc.class.php

示例6: import_library

 /**
  * 导入指定类库
  * 支持多个,当一次导入多个时,从数组最后一个开始导入
  *
  * 导入的格式必须是类似 com.a.b 的形式,否则会抛出异常,例如: `com.myqee.test`
  *
  *      Bootstrap::import_library('com.myqee.test');
  *      Bootstrap::import_library(array('com.myqee.test','com.myqee.cms'));
  *
  * @param string|array $library_name 指定类库 支持多个
  * @return num 返回新加载的类库总数
  */
 public static function import_library($library_name)
 {
     if (!$library_name) {
         return false;
     }
     $library_name = (array) $library_name;
     # 反向排序,从最后一个开始导入
     $library_name = array_reverse($library_name);
     $config_files = array();
     $load_num = 0;
     foreach ($library_name as $lib) {
         $set = self::_add_include_path_lib($lib);
         if (true === $set[2]) {
             # 已加载过
             continue;
         }
         $config_file = $set[1] . 'config' . EXT;
         if (is_file($config_file)) {
             $config_files[] = $config_file;
         }
         if (self::$core_config['runtime_config']) {
             $config_file = $set[1] . 'config' . self::$core_config['runtime_config'] . '.runtime' . EXT;
             if (is_file($config_file)) {
                 $config_files[] = $config_file;
             }
         }
         $load_num++;
         if (IS_DEBUG && class_exists('Core', false) && class_exists('Debug', false)) {
             Core::debug()->info('import a new library: ' . Core::debug_path($lib));
         }
     }
     if ($config_files) {
         __include_config_file(self::$config, $config_files);
     }
     return $load_num;
 }
开发者ID:liuyu121,项目名称:myqee,代码行数:48,代码来源:bootstrap.php

示例7: delete

 /**
  * 删除指定key的缓存,若$key===true则表示删除全部
  *
  * @param string $key
  */
 public function delete($key)
 {
     if (IS_DEBUG) {
         Core::debug()->info($key, 'database storage delete key');
     }
     if (is_array($key)) {
         $new_keys = array();
         foreach ($key as $k) {
             $k = $this->prefix . $k;
             $new_keys[] = md5($k);
         }
         $this->_handler->in('key', $new_keys);
     } elseif (true !== $key) {
         $key = $this->prefix . $key;
         $this->_handler->where('key', $key);
     }
     try {
         $this->_handler->delete($this->tablename);
         return true;
     } catch (Exception $e) {
         Core::debug()->warn($e->getMessage());
         return false;
     }
 }
开发者ID:xiaodin1,项目名称:myqee,代码行数:29,代码来源:database.class.php

示例8: request_urls

 /**
  * 支持多线程获取网页
  *
  * @see http://cn.php.net/manual/en/function.curl-multi-exec.php#88453
  * @param Array/string $urls
  * @param Int $timeout
  * @return Array
  */
 protected function request_urls($urls, $timeout = 10)
 {
     # 去重
     $urls = array_unique($urls);
     if (!$urls) {
         return array();
     }
     # 监听列表
     $listener_list = array();
     # 返回值
     $result = array();
     # 总列队数
     $list_num = 0;
     # 记录页面跳转数据
     $redirect_list = array();
     # 排队列表
     $multi_list = array();
     foreach ($urls as $url) {
         if ($this->multi_exec_num > 0 && $list_num >= $this->multi_exec_num) {
             # 加入排队列表
             $multi_list[] = $url;
         } else {
             # 列队数控制
             $listener_list[] = array($url, $this->_create($url, $timeout));
             $list_num++;
         }
         $result[$url] = null;
         $this->http_data[$url] = null;
     }
     # 已完成数
     $done_num = 0;
     while ($listener_list) {
         list($done_url, $f) = array_shift($listener_list);
         $time = microtime(1);
         $str = '';
         while (!feof($f)) {
             $str .= fgets($f);
         }
         fclose($f);
         $time = microtime(1) - $time;
         list($header, $body) = explode("\r\n\r\n", $str, 2);
         $header_arr = explode("\r\n", $header);
         $first_line = array_shift($header_arr);
         if (preg_match('#^HTTP/1.1 ([0-9]+) #', $first_line, $m)) {
             $code = $m[1];
         } else {
             $code = 0;
         }
         if (strpos($header, 'Transfer-Encoding: chunked')) {
             $body = explode("\r\n", $body);
             $body = array_slice($body, 1, -1);
             $body = implode('', $body);
         }
         if (preg_match('#Location(?:[ ]*):([^\\r]+)\\r\\n#Uis', $header, $m)) {
             if (count($redirect_list[$done_url]) >= 10) {
                 # 防止跳转次数太大
                 $body = $header = '';
                 $code = 0;
             } else {
                 # 302 跳转
                 $new_url = trim($m[1]);
                 $redirect_list[$done_url][] = $new_url;
                 // 插入列队
                 if (preg_match('#Set-Cookie(?:[ ]*):([^\\r+])\\r\\n#is', $header, $m2)) {
                     // 把cookie传递过去
                     $old_cookie = $this->cookies;
                     $this->cookies = $m2[1];
                 }
                 array_unshift($listener_list, array($done_url, $this->_create($new_url, $timeout)));
                 if (isset($old_cookie)) {
                     $this->cookies = $old_cookie;
                 }
                 continue;
             }
         }
         $rs = array('code' => $code, 'data' => $body, 'header' => $header_arr, 'time' => $time);
         $this->http_data[$done_url] = $rs;
         if ($rs['code'] != 200) {
             Core::debug()->error('URL:' . $done_url . ' ERROR,TIME:' . $this->http_data[$done_url]['time'] . ',CODE:' . $this->http_data[$done_url]['code']);
             $result[$done_url] = false;
         } else {
             Core::debug()->info('URL:' . $done_url . ' OK.TIME:' . $this->http_data[$done_url]['time']);
             $result[$done_url] = $rs['data'];
         }
         $done_num++;
         if ($multi_list) {
             # 获取列队中的一条URL
             $current_url = array_shift($multi_list);
             # 更新监听列队信息
             $listener_list[] = array($current_url, $this->_create($current_url, $timeout));
             # 更新列队数
             $list_num++;
//.........这里部分代码省略.........
开发者ID:liuyu121,项目名称:myqee,代码行数:101,代码来源:fsock.class.php

示例9: exec_by_curl

 /**
  * 通过CURL执行
  *
  * @param array $hosts
  * @param string $url
  * @param array $param_arr
  * @return array
  */
 protected static function exec_by_curl($hosts, $url, array $param_arr = null)
 {
     $mh = curl_multi_init();
     # 监听列表
     $listener_list = array();
     $vars = http_build_query($param_arr);
     # 创建列队
     foreach ($hosts as $h) {
         # 排除重复HOST
         if (isset($listener_list[$h])) {
             continue;
         }
         list($host, $port) = explode(':', $h, 2);
         if (!$port) {
             # 默认端口
             $port = $_SERVER["SERVER_PORT"];
         }
         # 一个mictime
         $mictime = microtime(1);
         # 生成一个随机字符串
         $rstr = Text::random();
         # 生成一个HASH
         $hash = self::get_hash($vars, $rstr, $mictime);
         # 创建一个curl对象
         $current = HttpCall::_create_curl($host, $port, $url, 10, $hash, $vars, $mictime, $rstr);
         # 列队数控制
         curl_multi_add_handle($mh, $current);
         $listener_list[$h] = $current;
     }
     unset($current);
     $running = null;
     $result = array();
     # 已完成数
     $done_num = 0;
     # 待处理数
     $list_num = count($listener_list);
     do {
         while (($execrun = curl_multi_exec($mh, $running)) == CURLM_CALL_MULTI_PERFORM) {
         }
         if ($execrun != CURLM_OK) {
             break;
         }
         while (true == ($done = curl_multi_info_read($mh))) {
             foreach ($listener_list as $done_host => $listener) {
                 if ($listener === $done['handle']) {
                     # 获取内容
                     $result[$done_host] = curl_multi_getcontent($done['handle']);
                     $code = curl_getinfo($done['handle'], CURLINFO_HTTP_CODE);
                     if ($code != 200) {
                         Core::debug()->error('system exec:' . $done_host . ' ERROR,CODE:' . $code);
                         //                             $result[$done_host] = false;
                     } else {
                         # 返回内容
                         Core::debug()->info('system exec:' . $done_host . ' OK.');
                     }
                     curl_close($done['handle']);
                     curl_multi_remove_handle($mh, $done['handle']);
                     unset($listener_list[$done_host], $listener);
                     $done_num++;
                     $time = microtime(1);
                     break;
                 }
             }
         }
         if ($done_num >= $list_num) {
             break;
         }
         if (!$running) {
             break;
         }
     } while (true);
     # 关闭列队
     curl_multi_close($mh);
     return $result;
 }
开发者ID:myqee,项目名称:core,代码行数:83,代码来源:httpcall.class.php

示例10: close_all_connect

 /**
  * 关闭所有链接
  */
 public static function close_all_connect()
 {
     foreach (Storage_Driver_Swift::$connections as $host => $obj) {
         try {
             fclose($obj);
         } catch (Exception $e) {
             Core::debug()->error('close swift storage connect error:' . $e->getMessage());
         }
         Storage_Driver_Swift::$connections[$host] = null;
     }
     # 重置全部数据
     Storage_Driver_Swift::$connections = array();
     Storage_Driver_Swift::$last_used = array();
     Storage_Driver_Swift::$requests_num = array();
     if (IS_DEBUG) {
         Core::debug()->info('close all swift storage server.');
     }
 }
开发者ID:liuyu121,项目名称:myqee,代码行数:21,代码来源:swift.class.php

示例11: clear_cache

 /**
  * 清除配置缓存
  *
  * @return boolean
  */
 public function clear_cache($type = '')
 {
     if (!$this->is_use_cache) {
         // 非普通文件写入,不缓存,无需清理
         return true;
     }
     $tmp_file = array();
     $projects = array_keys((array) Core::config('core.projects'));
     if ($projects) {
         foreach ($projects as $project) {
             # 所有项目的配置文件
             $tmp_file[] = $this->get_config_cache_file($project, $type);
         }
     }
     if (!$tmp_file) {
         return true;
     }
     $rs = File::unlink($tmp_file);
     if (IS_DEBUG) {
         Core::debug()->log('clear extends config cache ' . ($rs ? 'success' : 'fail') . '.');
     }
     return $rs;
 }
开发者ID:liuyu121,项目名称:myqee,代码行数:28,代码来源:config.class.php

示例12: query

 /**
  * 查询
  *
  * $use_connection_type 默认不传为自动判断,可传true/false,若传字符串(只支持a-z0-9的字符串),则可以切换到另外一个连接,比如传other,则可以连接到$this->_connection_other_id所对应的ID的连接
  *
  * @param string $sql 查询语句
  * @param string $as_object 是否返回对象
  * @param boolean $use_connection_type 是否使用主数据库,不设置则自动判断
  * @return Database_Driver_Postgre_Result
  */
 public function query($sql, $as_object = null, $use_connection_type = null)
 {
     $sql = trim($sql);
     if (preg_match('#^([a-z]+)(:? |\\n|\\r)#i', $sql, $m)) {
         $type = strtoupper($m[1]);
     } else {
         $type = null;
     }
     $typeArr = array('SELECT', 'SHOW', 'EXPLAIN', 'DESCRIBE', 'INSERT', 'REPLACE', 'UPDATE', 'DELETE');
     if (!in_array($type, $typeArr)) {
         $type = 'MASTER';
     }
     $slaverType = array('SELECT', 'SHOW', 'EXPLAIN');
     if ($type != 'MASTER' && in_array($type, $slaverType)) {
         if (true === $use_connection_type) {
             $use_connection_type = 'master';
         } else {
             if (is_string($use_connection_type)) {
                 if (!preg_match('#^[a-z0-9_]+$#i', $use_connection_type)) {
                     $use_connection_type = 'master';
                 }
             } else {
                 $use_connection_type = 'slaver';
             }
         }
     } else {
         $use_connection_type = 'master';
     }
     # 设置连接类型
     $this->_set_connection_type($use_connection_type);
     # 连接数据库
     $connection = $this->connection();
     # 记录调试
     if (IS_DEBUG) {
         Core::debug()->info($sql, 'Postgre');
         static $is_sql_debug = null;
         if (null === $is_sql_debug) {
             $is_sql_debug = (bool) Core::debug()->profiler('sql')->is_open();
         }
         if ($is_sql_debug) {
             $host = $this->_get_hostname_by_connection_hash($this->connection_id());
             $benchmark = Core::debug()->profiler('sql')->start('Database', 'postgre://' . ($host['username'] ? $host['username'] . '@' : '') . $host['hostname'] . ($host['port'] && $host['port'] != '3306' ? ':' . $host['port'] : '') . $host['database']);
         }
     }
     // Execute the query
     if (($result = pg_query($connection, $sql)) === false) {
         if (isset($benchmark)) {
             // This benchmark is worthless
             $benchmark->delete();
         }
         if (IS_DEBUG) {
             $err = 'Error:' . pg_last_error($connection) . '. PostgreSQL:' . $sql;
         } else {
             $err = pg_last_error($connection);
         }
         throw new Exception($err);
     }
     if (isset($benchmark)) {
         Core::debug()->profiler('sql')->stop();
     }
     // Set the last query
     $this->last_query = $sql;
     if ($type === 'INSERT' || $type === 'REPLACE') {
         // Return a list of insert id and rows created
         return array($this->_insert_id($connection), pg_affected_rows($connection));
     } elseif ($type === 'UPDATE' || $type === 'DELETE') {
         // Return the number of rows affected
         return pg_affected_rows($connection);
     } else {
         // Return an iterator of results
         return new Database_Driver_Postgre_Result($result, $sql, $as_object, $this->config);
     }
 }
开发者ID:liuyu121,项目名称:myqee,代码行数:83,代码来源:postgre.class.php

示例13: query

 /**
  * 查询
  *
  * $use_connection_type 默认不传为自动判断,可传true/false,若传字符串(只支持a-z0-9的字符串),则可以切换到另外一个连接,比如传other,则可以连接到$this->_connection_other_id所对应的ID的连接
  *
  * @param string $sql 查询语句
  * @param string $as_object 是否返回对象
  * @param boolean $use_connection_type 是否使用主数据库,不设置则自动判断
  * @return \Database_Driver_MySQL_Result
  */
 public function query($sql, $as_object = null, $use_connection_type = null)
 {
     $sql = \trim($sql);
     if (\preg_match('#^([a-z]+)(:? |\\n|\\r)#i', $sql, $m)) {
         $type = \strtoupper($m[1]);
     }
     $typeArr = array('SELECT', 'SHOW', 'EXPLAIN', 'DESCRIBE', 'INSERT', 'REPLACE', 'UPDATE', 'DELETE');
     if (!\in_array($type, $typeArr)) {
         $type = 'MASTER';
     }
     $slaverType = array('SELECT', 'SHOW', 'EXPLAIN');
     if ($type != 'MASTER' && \in_array($type, $slaverType)) {
         if (true === $use_connection_type) {
             $use_connection_type = 'master';
         } else {
             if (\is_string($use_connection_type)) {
                 if (!\preg_match('#^[a-z0-9_]+$#i', $use_connection_type)) {
                     $use_connection_type = 'master';
                 }
             } else {
                 $use_connection_type = 'slaver';
             }
         }
     } else {
         $use_connection_type = 'master';
     }
     # 设置连接类型
     $this->_set_connection_type($use_connection_type);
     # 连接数据库
     $connection = $this->connection();
     # 记录调试
     if (\IS_DEBUG) {
         \Core::debug()->info($sql, 'MySQL');
         static $is_sql_debug = null;
         if (null === $is_sql_debug) {
             $is_sql_debug = (bool) \Core::debug()->profiler('sql')->is_open();
         }
         if ($is_sql_debug) {
             $host = $this->_get_hostname_by_connection_hash($this->connection_id());
             $benchmark = \Core::debug()->profiler('sql')->start('Database', 'mysqli://' . ($host['username'] ? $host['username'] . '@' : '') . $host['hostname'] . ($host['port'] && $host['port'] != '3306' ? ':' . $host['port'] : ''));
         }
     }
     static $is_no_cache = null;
     if (null === $is_no_cache) {
         $is_no_cache = (bool) \Core::debug()->profiler('nocached')->is_open();
     }
     //显示无缓存数据
     if ($is_no_cache && \strtoupper(\substr($sql, 0, 6)) == 'SELECT') {
         $sql = 'SELECT SQL_NO_CACHE' . \substr($sql, 6);
     }
     // Execute the query
     if (($result = \mysql_query($sql, $connection)) === false) {
         if (isset($benchmark)) {
             // This benchmark is worthless
             $benchmark->delete();
         }
         if (\IS_DEBUG) {
             $err = 'Error:' . \mysql_error($connection) . '. SQL:' . $sql;
         } else {
             $err = \mysql_error($connection);
         }
         throw new \Exception($err, \mysql_errno($connection));
     }
     if (isset($benchmark)) {
         # 在线查看SQL情况
         if ($is_sql_debug) {
             $data = array();
             $data[0]['db'] = $host['hostname'] . '/' . $this->config['connection']['database'] . '/';
             $data[0]['select_type'] = '';
             $data[0]['table'] = '';
             $data[0]['key'] = '';
             $data[0]['key_len'] = '';
             $data[0]['Extra'] = '';
             $data[0]['query'] = '';
             $data[0]['type'] = '';
             $data[0]['id'] = '';
             $data[0]['row'] = \count($result);
             $data[0]['ref'] = '';
             $data[0]['all rows'] = '';
             $data[0]['possible_keys'] = '';
             if (\strtoupper(\substr($sql, 0, 6)) == 'SELECT') {
                 $re = \mysql_query('EXPLAIN ' . $sql, $connection);
                 $i = 0;
                 while (true == ($row = \mysql_fetch_array($re, \MYSQL_NUM))) {
                     $data[$i]['select_type'] = (string) $row[1];
                     $data[$i]['table'] = (string) $row[2];
                     $data[$i]['key'] = (string) $row[5];
                     $data[$i]['key_len'] = (string) $row[6];
                     $data[$i]['Extra'] = (string) $row[9];
                     if ($i == 0) {
//.........这里部分代码省略.........
开发者ID:google2013,项目名称:myqee,代码行数:101,代码来源:mysql.class.php

示例14: find

 /**
  * 获取数据
  *
  * @param $query 请求的参数
  * @return OOP_ORM_Result
  */
 public function find($query = null)
 {
     if (!$this->api_url) {
         throw new Exception(__('orm api url is not declared.'));
     }
     $url = $this->parse_api_fullurl($query);
     try {
         if ($this->method == 'POST') {
             $rs = (string) $this->driver()->post($url, $this->parse_api_post_data($query));
         } else {
             if ($this->method == 'PUT') {
                 $rs = (string) $this->driver()->put($url, $this->parse_api_post_data($query));
             } else {
                 if ($this->method == 'DELETE') {
                     $rs = (string) $this->driver()->delete($url);
                 } else {
                     if ($this->method != 'GET') {
                         $this->driver()->method($this->method);
                     }
                     $rs = (string) $this->driver()->get($url);
                 }
             }
         }
     } catch (Exception $e) {
         Core::debug()->warn('ORM获取数据失败,URL:' . $url);
         $rs = '[]';
     }
     $this->last_query = $url;
     // 处理解析数据
     $this->parse_result_data($rs);
     // 重置数据
     $this->reset();
     return $this->create_group_data($rs, true);
 }
开发者ID:google2013,项目名称:myqee-1,代码行数:40,代码来源:rest.class.php

示例15: foreach

 *
 * @category Core
 * @package  LeQG
 * @author   Damien Senger <hi@hiwelo.co>
 * @license  https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License 3.0
 * @link     http://leqg.info
 */
require_once 'includes.php';
$link = Configuration::read('db.link');
$query = $link->prepare('SELECT * FROM `TABLE 30` LIMIT 0, 50');
$query->execute();
$contacts = $query->fetchAll(PDO::FETCH_ASSOC);
foreach ($contacts as $contact) {
    $person = People::create();
    $person = new People($person);
    Core::debug($contact, false);
    // Traitement du nom
    $person->update('nom', $contact['NOM']);
    $person->update('prenoms', $contact['PRENOM']);
    // On paramètre le sexe
    $genre = trim($contact['GENRE']);
    if ($genre == 'Madame') {
        $person->update('sexe', 'F');
    } else {
        $person->update('sexe', 'H');
    }
    $adresse = array('pays' => 'France', 'ville' => '', 'zip' => '', 'street' => '', 'building' => '');
    $decomposition_rue = explode(' ', $contact['ADRESSE 3']);
    $numero = $decomposition_rue[0];
    $first = substr($numero, 0, 1);
    if (is_numeric($first)) {
开发者ID:leqg,项目名称:leqg,代码行数:31,代码来源:transfert.php


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