• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP print_r函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: dump

function dump($var, $echo = true, $label = null, $strict = true)
{
    $label = $label === null ? '' : rtrim($label) . ' ';
    if (!$strict) {
        if (ini_get('html_errors')) {
            $output = print_r($var, true);
            $output = "<pre>" . $label . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
        } else {
            $output = $label . " : " . print_r($var, true);
        }
    } else {
        ob_start();
        var_dump($var);
        $output = ob_get_clean();
        if (!extension_loaded('xdebug')) {
            $output = preg_replace("/\\]\\=\\>\n(\\s+)/m", "] => ", $output);
            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES, "GB2312") . '</pre>';
        }
    }
    if ($echo) {
        echo $output;
        return null;
    } else {
        return $output;
    }
}
开发者ID:winiceo,项目名称:job,代码行数:26,代码来源:lib.php


示例2: sshiconn

function sshiconn($cmd, $pass, $ip, $sshp = 22)
{
    $ip = $_REQUEST['ip'];
    $pass = $_REQUEST['pass'];
    $sshp = $_REQUEST['sshp'];
    if (!isset($_REQUEST['sshp'])) {
        $sshp = '22';
    }
    $connection = ssh2_connect($ip, $sshp);
    if (!$connection) {
        throw new Exception("fail: unable to establish connection\nPlease IP or if server is on and connected");
    }
    $pass_success = ssh2_auth_password($connection, 'root', $pass);
    if (!$pass_success) {
        throw new Exception("fail: unable to establish connection\nPlease Check your password");
    }
    $stream = ssh2_exec($connection, $cmd);
    $errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
    stream_set_blocking($errorStream, true);
    stream_set_blocking($stream, true);
    print_r($cmd);
    $output = stream_get_contents($stream);
    fclose($stream);
    fclose($errorStream);
    ssh2_exec($connection, 'exit');
    unset($connection);
    return $output;
}
开发者ID:shadowhome,项目名称:synxb,代码行数:28,代码来源:functions.php


示例3: _group2ldap

 /**
  * convert objects with user data to ldap data array
  * 
  * @param Tinebase_Model_FullUser  $_user
  * @param array                    $_ldapData  the data to be written to ldap
  */
 protected function _group2ldap(Tinebase_Model_Group $_group, array &$_ldapData)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ENCRYPT ' . print_r($_ldapData, true));
     }
     if (isset($_ldapData['objectclass'])) {
         $_ldapData['objectclass'] = array_unique(array_merge($_ldapData['objectclass'], $this->_requiredObjectClass));
     }
     if (isset($_ldapData['gidnumber'])) {
         $gidNumber = $_ldapData['gidnumber'];
     } else {
         $gidNumber = $this->_getGidNumber($_group->getId());
     }
     // when we try to add a group, $_group has no id which leads to Tinebase_Exception_InvalidArgument in $this->_getGroupMetaData
     try {
         $metaData = $this->_getGroupMetaData($_group);
     } catch (Tinebase_Exception_InvalidArgument $teia) {
         $metaData = array();
     }
     if (!isset($metaData['sambasid'])) {
         $_ldapData['sambasid'] = $this->_options[Tinebase_Group_Ldap::PLUGIN_SAMBA]['sid'] . '-' . (2 * $gidNumber + 1001);
         $_ldapData['sambagrouptype'] = 2;
     }
     $_ldapData['displayname'] = $_group->name;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:31,代码来源:Samba.php


示例4: facebook

 public function facebook()
 {
     $user = Socialize::with('facebook')->user();
     // Do your stuff with user data.
     print_r($user);
     die;
 }
开发者ID:surajch,项目名称:ensue-me,代码行数:7,代码来源:AccountController.php


示例5: search_ac_init

function search_ac_init(&$a)
{
    if (!local_channel()) {
        killme();
    }
    $start = x($_REQUEST, 'start') ? $_REQUEST['start'] : 0;
    $count = x($_REQUEST, 'count') ? $_REQUEST['count'] : 100;
    $search = x($_REQUEST, 'search') ? $_REQUEST['search'] : "";
    if (x($_REQUEST, 'query') && strlen($_REQUEST['query'])) {
        $search = $_REQUEST['query'];
    }
    // Priority to people searches
    if ($search) {
        $people_sql_extra = protect_sprintf(" AND `xchan_name` LIKE '%" . dbesc($search) . "%' ");
        $tag_sql_extra = protect_sprintf(" AND term LIKE '%" . dbesc($search) . "%' ");
    }
    $r = q("SELECT `abook_id`, `xchan_name`, `xchan_photo_s`, `xchan_url`, `xchan_addr` FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d \n\t\t{$people_sql_extra}\n\t\tORDER BY `xchan_name` ASC ", intval(local_channel()));
    $results = array();
    if ($r) {
        foreach ($r as $g) {
            $results[] = array("photo" => $g['xchan_photo_s'], "name" => '@' . $g['xchan_name'], "id" => $g['abook_id'], "link" => $g['xchan_url'], "label" => '', "nick" => '');
        }
    }
    $r = q("select distinct term, tid, url from term where type in ( %d, %d ) {$tag_sql_extra} group by term order by term asc", intval(TERM_HASHTAG), intval(TERM_COMMUNITYTAG));
    if (count($r)) {
        foreach ($r as $g) {
            $results[] = array("photo" => $a->get_baseurl() . '/images/hashtag.png', "name" => '#' . $g['term'], "id" => $g['tid'], "link" => $g['url'], "label" => '', "nick" => '');
        }
    }
    header("content-type: application/json");
    $o = array('start' => $start, 'count' => $count, 'items' => $results);
    echo json_encode($o);
    logger('search_ac: ' . print_r($x, true));
    killme();
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:35,代码来源:search_ac.php


示例6: request

 /**
  * @param string $url
  * @param string $method
  * @param string $body
  *
  * @return FhirResponse
  */
 public function request($url, $method = 'GET', $body = null)
 {
     $server_name = null;
     foreach ($this->servers as $name => $server) {
         if (substr($url, 0, strlen($server['base_url']))) {
             $server_name = $name;
             break;
         }
     }
     $this->applyServerConfig($server_name ? $this->servers[$server_name] : array());
     $this->http_client->setUri($url);
     $this->http_client->setMethod($method);
     if ($body) {
         $this->http_client->setRawData($body, 'application/xml+fhir; charset=utf-8');
     }
     $response = $this->http_client->request();
     $this->http_client->resetParameters();
     if ($body = $response->getBody()) {
         $use_errors = libxml_use_internal_errors(true);
         $value = Yii::app()->fhirMarshal->parseXml($body);
         $errors = libxml_get_errors();
         libxml_use_internal_errors($use_errors);
         if ($errors) {
             throw new Exception("Error parsing XML response from {$method} to {$url}: " . print_r($errors, true));
         }
     } else {
         $value = null;
     }
     return new FhirResponse($response->getStatus(), $value);
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:37,代码来源:FhirClient.php


示例7: get_all_taxa

 function get_all_taxa()
 {
     require_library('connectors/INBioAPI');
     $func = new INBioAPI();
     $paths = $func->extract_archive_file($this->dwca_file, "meta.xml");
     $archive_path = $paths['archive_path'];
     $temp_dir = $paths['temp_dir'];
     $harvester = new ContentArchiveReader(NULL, $archive_path);
     $tables = $harvester->tables;
     if (!($this->fields["taxa"] = $tables["http://rs.tdwg.org/dwc/terms/taxon"][0]->fields)) {
         debug("Invalid archive file. Program will terminate.");
         return false;
     }
     self::build_taxa_rank_array($harvester->process_row_type('http://rs.tdwg.org/dwc/terms/Taxon'));
     self::create_instances_from_taxon_object($harvester->process_row_type('http://rs.tdwg.org/dwc/terms/Taxon'));
     self::get_objects($harvester->process_row_type('http://eol.org/schema/media/Document'));
     self::get_references($harvester->process_row_type('http://rs.gbif.org/terms/1.0/Reference'));
     self::get_agents($harvester->process_row_type('http://eol.org/schema/agent/Agent'));
     self::get_vernaculars($harvester->process_row_type('http://rs.gbif.org/terms/1.0/VernacularName'));
     $this->archive_builder->finalize(TRUE);
     // remove temp dir
     recursive_rmdir($temp_dir);
     echo "\n temporary directory removed: " . $temp_dir;
     print_r($this->debug);
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:25,代码来源:WormsArchiveAPI.php


示例8: print_r

 /**
  * @param $data
  */
 public static function print_r($data)
 {
     echo "<pre>";
     print_r($data);
     echo "</pre>";
     return;
 }
开发者ID:JonathaCesar,项目名称:EasyFramework,代码行数:10,代码来源:Basic.php


示例9: createSymbolicLink

 public static function createSymbolicLink($rootDir = null)
 {
     IS_MULTI_MODULES || exit('please set is_multi_modules => true');
     $deper = Request::isCli() ? PHP_EOL : '<br />';
     echo "{$deper}**************************create link start!*********************{$deper}";
     echo '|' . str_pad('', 64, ' ', STR_PAD_BOTH) . '|';
     is_null($rootDir) && ($rootDir = ROOT_PATH . DIRECTORY_SEPARATOR . 'web');
     is_dir($rootDir) || mkdir($rootDir, true, 0700);
     //modules_static_path_name
     // 递归遍历目录
     $dirIterator = new \DirectoryIterator(APP_MODULES_PATH);
     foreach ($dirIterator as $file) {
         if (!$file->isDot() && $file->isDir()) {
             $resourceDir = $file->getPathName() . DIRECTORY_SEPARATOR . Config::get('modules_static_path_name');
             if (is_dir($resourceDir)) {
                 $distDir = ROOT_PATH . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . $file->getFilename();
                 $cmd = Request::operatingSystem() ? "mklink /d {$distDir} {$resourceDir}" : "ln -s {$resourceDir} {$distDir}";
                 exec($cmd, $result);
                 $tip = "create link Application [{$file->getFilename()}] result : [" . (is_dir($distDir) ? 'true' : 'false') . "]";
                 $tip = str_pad($tip, 64, ' ', STR_PAD_BOTH);
                 print_r($deper . '|' . $tip . '|');
             }
         }
     }
     echo $deper . '|' . str_pad('', 64, ' ', STR_PAD_BOTH) . '|';
     echo "{$deper}****************************create link end!**********************{$deper}";
 }
开发者ID:phpdn,项目名称:framework,代码行数:27,代码来源:StaticResource.php


示例10: addFailure

 /**
  * A failure occurred.
  *
  * @param  PHPUnit_Framework_Test				 $test
  * @param  PHPUnit_Framework_AssertionFailedError $e
  * @param  float								  $time
  */
 public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
 {
     $this->write('fail: ' . $e->getMessage());
     $trace = current(PHPUnit_Util_Filter::getFilteredStacktrace($e, FALSE));
     $this->write('trace: ' . print_r($trace, 1));
     $this->currentTestPass = FALSE;
 }
开发者ID:k-kalashnikov,项目名称:geekcon.local,代码行数:14,代码来源:phpunit_test_listener_plain.php


示例11: printTest

function printTest()
{
    //Tracert HP817ACF
    //$handle = printer_open() ;// Gets the default printer and prints to it.
    //$handle = printer_open('\\\\192.168.1.247\\HP817ACF');
    $handle = printer_open('HP Deskjet 3540 series (Network)');
    // Gets the printer by name, to get printer name, go to devices and printers option, select a printer on the network , you will see the name on top
    //HP Deskjet 3540 series (Network)
    print_r($handle);
    printer_start_doc($handle, "My Document");
    printer_start_page($handle);
    $font = printer_create_font("Arial", 72, 48, 400, false, false, false, 0);
    printer_select_font($handle, $font);
    printer_draw_text($handle, "test", 10, 10);
    printer_delete_font($font);
    printer_end_page($handle);
    printer_end_doc($handle);
    printer_close($handle);
    //$fh = fopen("filename.ext", "rb");
    // $content = fread($fh, filesize("filename.ext"));
    //fclose($fh);
    /*printer_set_option($handle, PRINTER_MODE, "text");
    printer_write($handle, "TEXT To print");
    printer_close($handle);
    
    */
}
开发者ID:samurailens,项目名称:sop,代码行数:27,代码来源:testprinter.php


示例12: __construct

 /**
  * Constructor
  *
  * @param array  $options An array of arrays of IMAP options
  * @param string $username
  * @param string $password
  */
 public function __construct(array $options = array(), $username = null, $password = null)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($options, true));
     }
     parent::__construct($options, $username, $password);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:14,代码来源:Imap.php


示例13: role_editAct

 /**
  * 编辑角色
  */
 public function role_editAct()
 {
     if (IS_POST) {
         $id = intval(I("post.id"));
         if ($id == 1) {
             $this->error("超级管理员角色不能被修改!");
         }
         $data = D("Role")->create();
         if ($data) {
             if (D("Role")->save($data) !== false) {
                 $this->success("修改成功!", UC('Rbac/index'));
             } else {
                 $this->error("修改失败!" . D("Role")->getlastsql() . print_r($data, true));
             }
         } else {
             $this->error(D("Role")->getError());
         }
     } else {
         $id = intval(I("get.id"));
         if (!$id) {
             $this->error("非法操作!");
         }
         if ($id == 1) {
             $this->error("超级管理员角色不能被修改!");
         }
         $data = D("Role")->field('id, status, remark, name')->where(array("id" => $id))->find();
         if (!$data) {
             $this->error("该角色不存在!");
         }
         $this->assign("headline", "编辑角色");
         $this->assign("action_name", ACTION_NAME);
         $this->assign("info", $data);
         $this->display("Rbac:role_oper");
     }
 }
开发者ID:skyshow,项目名称:ticket,代码行数:38,代码来源:RbacAdmin.class.php


示例14: post

 /**
  * Handle a POST request for this map save ressource
  * @param Request request
  * @return Response
  */
 function post($request)
 {
     $response = new Response($request);
     if (isset($_POST['map'])) {
         // Remove those slashes
         if (get_magic_quotes_gpc()) {
             $map = stripslashes($_POST['map']);
         } else {
             $map = $_POST['map'];
         }
         $map_obj = json_decode($map);
         $geocacheManager = GeocacheManager::getInstance();
         $geocaches = $geocacheManager->parseGeocaches($map_obj->{"geocaches"});
         foreach ($geocaches as $geocache) {
             $geocache->save();
         }
         $ownWaypoints = $geocacheManager->parseOwnWaypoints($map_obj->{"costumMarkers"});
         foreach ($ownWaypoints as $ownWaypoint) {
             $ownWaypoint->save();
         }
         $response->code = Response::OK;
         $response->addHeader('Content-type', 'text/plain');
         $response->body = print_r($map, true);
     } else {
         $response->code = Response::BADREQUEST;
     }
     return $response;
 }
开发者ID:ThomDietrich,项目名称:gctour,代码行数:33,代码来源:map_save.php


示例15: neat_r

function neat_r($arr, $return = false)
{
    $out = array();
    $oldtab = "    ";
    $newtab = "  ";
    $lines = explode("\n", print_r($arr, true));
    foreach ($lines as $line) {
        if (substr($line, -5) != "Array") {
            $line = preg_replace("/^(\\s*)\\[[0-9]+\\] => /", "\$1", $line, 1);
        }
        foreach (array("Array" => "", "[" => "", "]" => "", " =>" => ":") as $old => $new) {
            $out = str_replace($old, $new, $out);
        }
        if (in_array(trim($line), array("Array", "(", ")", ""))) {
            continue;
        }
        $indent = "\n";
        $indents = floor((substr_count($line, $oldtab) - 1) / 2);
        if ($indents > 0) {
            for ($i = 0; $i < $indents; $i++) {
                $indent .= $newtab;
            }
        }
        $out[] = $indent . trim($line);
    }
    $out = implode("<br/>", $out) . "\n";
    if ($return == true) {
        return $out;
    }
    echo $out;
}
开发者ID:sreeram77,项目名称:codejam,代码行数:31,代码来源:functions.php


示例16: smarty_function_json

/**
 * Smarty {json} plugin
 *
 * Type:       function
 * Name:       json
 * Date:       Apr 12, 2009
 * Purpose:    Read JSON from file, decode and assign data to Smarty template variable
 * Syntax:     {json file="filename.json"}: 'file' is a required parameter (URL)
 *             Predefined additional parameters:
 *             - assign="data": assign all JSON data to template variable $data
 *             - obj2obj [ Boolean | default:false ]:
 *               decodes JSON objects as either PHP associative arrays or PHP objects
 *             - debug [ Boolean | default:false ]: print decoded data in template
 *             Variable parameters:
 *             {json file="filename.json" home="homepage" lang="languages"}:
 *               assign (JSONdata)["homepage"] to template variable $home
 *               and (JSONdata)["languages"] to $lang,
 *               compare to: {config_load file="filename.conf" section="homepage"}
 * Install:    Drop into the plugin directory
 * @link       http://jlix.net/extensions/smarty/json
 * @author     Sander Aarts <smarty at jlix dot net>
 * @copyright  2009 Sander Aarts
 * @license    LGPL License
 * @version    1.0.1
 * @param      array
 * @param      Smarty
 */
function smarty_function_json($params, &$smarty)
{
    if (!is_callable('json_decode')) {
        $smarty->_trigger_fatal_error("{json} requires json_decode() function (PHP 5.2.0+)");
    }
    if (empty($params['file'])) {
        $smarty->_trigger_fatal_error("{json} parameter 'file' must not be empty");
    }
    if (isset($params['assign'], $params[$params['assign']])) {
        $smarty->_trigger_fatal_error("{json} parameter 'assign' conflicts with a variable assign parameter (both refer to the same variable)");
    }
    $assoc = $params['obj2obj'] == true ? false : true;
    $json = trim(file_get_contents($params['file']));
    $data = json_decode($json, $assoc);
    if ($params['debug'] == true) {
        echo "<pre>";
        print_r($data);
        echo "</pre>";
    }
    unset($params['file'], $params['obj2obj'], $params['debug']);
    $assign = array();
    foreach ($params as $key => $value) {
        if ($key === 'assign') {
            $assign[$value] = $data;
        } else {
            $assign[$key] = $assoc ? $data[$value] : $data->{$value};
        }
    }
    if (count($assign) > 0) {
        $smarty->assign($assign);
    } else {
        return $data;
    }
}
开发者ID:GORepo,项目名称:GO_Yap_Snrt,代码行数:61,代码来源:function.json.php


示例17: checkTokenESB

function checkTokenESB($token)
{
    global $debugar;
    if ($debugar) {
        echo 'checkTokenESB(): checking token "' . $token . '".<br />' . "\n";
    }
    if (!isset($token)) {
        if ($debugar) {
            echo 'checkTokenESB(): KO, empty token.<br />' . "\n";
        }
        $token = isset($_REQUEST['token']) ? $_REQUEST['token'] : null;
    }
    if ($token == NULL) {
        if ($debugar) {
            echo 'checkTokenESB(): KO, null token.<br />' . "\n";
        }
        $output[] = array('errorNumber' => 1, 'errorText' => 'Identification token is required');
        echo json_encode($output);
        die;
    } else {
        // Check credentials in EBS
        // http://esb.exactls.com/collage/cas/user?token=ST-114-vC2Gb1k1vDGgxlkoefFm-cas01.example.org
        // If the token is invalid, file_get_contents raises an error.
        $credentials = getUserCredentials($token);
        if ($debugar) {
            echo 'checkTokenESB(): downloaded credentials: "' . print_r($credentials, TRUE) . '".<br />' . "\n";
        }
        return $credentials;
    }
}
开发者ID:Peaso,项目名称:CER,代码行数:30,代码来源:functions.php


示例18: wait

 public function wait()
 {
     $data['current'] = array('data_back' => '', 'user_manage' => '', 'user_data' => '', 'teacher_data' => '', 'add_teacher' => '', 'classify_manage' => '', 'all_classify' => '', 'course_manage' => 'current', 'required_course' => 'current', 'elective_course' => '', 'skill_course' => '', 'video_manage' => '', 'all_video' => '', 'upload_video' => '', 'order_manage' => '', 'all_order' => '', 'account_data' => '', 'feedback_manage' => '', 'all_feedback' => '', 'comment_manage' => '', 'all_comment' => '', 'link_manage' => '', 'all_link' => '', 'add_link' => '', 'activity_manage' => '', 'add_activity' => '', 'all_activity' => '');
     $page_config['perpage'] = 9;
     //每页条数
     $page_config['part'] = 2;
     //当前页前后链接数量
     $page_config['url'] = '/admin/required/check';
     //url
     $page_config['seg'] = 4;
     //参数取 index.php之后的段数,默认为3,即index.php/control/function/18 这种形式
     $page_config['nowindex'] = $this->uri->segment($page_config['seg']) ? $this->uri->segment($page_config['seg']) : 1;
     //当前页
     $this->load->library('mypage_class');
     $page_config['total'] = count($this->required_model->query_by_check());
     // file_put_contents("/home/tanxu/www/data.txt", $page_config['total']);
     $this->mypage_class->initialize($page_config);
     if ((int) $page_config['nowindex'] == 1) {
         $data['check'] = $this->required_model->get_num_course(0, (int) $page_config['perpage'], 0);
         file_put_contents("/home/tanxu/www/data.txt", print_r($data['check'], true));
     } else {
         $firstcount = ((int) $page_config['nowindex'] - 1) * (int) $page_config['perpage'];
         $data['check'] = $this->required_model->get_num_course(0, (int) $page_config['perpage'], $firstcount);
     }
     $this->load->view('admin/admin_header.html', $data);
     $this->load->view('admin/admin_required_check.html');
 }
开发者ID:xiajb,项目名称:code32,代码行数:27,代码来源:Required.php


示例19: getAllUser

 public function getAllUser()
 {
     $allUser = array();
     $doc = new DOMDocument();
     print_r(XML_DB_PATH);
     $doc->load(XML_DB_PATH);
     $users = $doc->getElementsByTagName("user");
     foreach ($users as $user) {
         $usernames = $user->getElementsByTagName("username");
         $username = $usernames->item(0)->nodeValue;
         $passwords = $user->getElementsByTagName("password");
         $password = $passwords->item(0)->nodeValue;
         //			$userids = $user->getElementsByTagName( "userid" );
         //			$userid = $userids->item(0)->nodeValue;
         $userid = $user->getAttribute("userid");
         $userroles = $user->getElementsByTagName("userrole");
         $userrole = $userroles->item(0)->nodeValue;
         $controlblocks = $user->getElementsByTagName("controlblock");
         $controlblock = $controlblocks->item(0)->nodeValue;
         $names = $user->getElementsByTagName("name");
         $name = $names->item(0)->nodeValue;
         $temp = new stdClass();
         $temp->userid = $userid;
         $temp->username = $username;
         $temp->password = $password;
         $temp->userrole = $userrole;
         $temp->controlblock = $controlblock;
         $temp->name = $name;
         $allUser[count($allUser)] = $temp;
     }
     return $allUser;
 }
开发者ID:utcuong3010,项目名称:vng,代码行数:32,代码来源:XMLUser.php


示例20: __save

 /**
  * Fetches hashed data from db and put into instance
  */
 private function __save()
 {
     $class = $this->class;
     $database = new database($class::$database);
     if ($this->get_attributes()) {
         $columns = "(`{$class::$entity_id_column}`, `{$class::$key_column}`, `{$class::$value_column}`, `date_added`, `date_updated`)";
         $placeholders = $values = $duplicate_keys = array();
         foreach ($this->get_attributes() as $key => $value) {
             $placeholders[] = "(%d, %s, %s, NOW(), NOW())";
             $values[] = $this->entity_id;
             $values[] = $key;
             $values[] = $value;
             $duplicate_keys[] = "`{$class::$value_column}` = VALUES(`{$class::$value_column}`)";
         }
         $duplicate_keys[] = '`date_updated` = VALUES(`date_updated`)';
         $database->query("INSERT INTO {$class::$table} {$columns} VALUES " . implode(', ', $placeholders) . " ON DUPLICATE KEY UPDATE " . implode(', ', $duplicate_keys), $values);
     }
     if ($unset_keys = array_diff($this->original_keys, array_keys($this->get_attributes()))) {
         // we unset something
         print_r(array($this->entity_id, $unset_keys));
         database::enable_log();
         $database->query("DELETE FROM {$class::$table} WHERE `{$class::$entity_id_column}` = %d AND `{$class::$key_column}` IN (%s)", array($this->entity_id, $unset_keys));
     }
     return true;
 }
开发者ID:revcozmo,项目名称:dating,代码行数:28,代码来源:entity_hash.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP print_radio_row函数代码示例发布时间:2022-05-15
下一篇:
PHP print_question_icon函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap