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

PHP write函数代码示例

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

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



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

示例1: write

 function write(XMLWriter $xml, $data)
 {
     foreach ($data as $_key => $value) {
         // check the key isnt a number, (numeric keys invalid in XML)
         if (is_numeric($_key)) {
             $key = 'element';
         } else {
             if (!is_string($_key) || empty($_key) || strncmp($_key, '_', 1) === 0) {
                 continue;
             } else {
                 $key = $_key;
             }
         }
         $xml->startElement($key);
         // if the key is numeric, add an ID attribute to make tags properly unique
         if (is_numeric($_key)) {
             $xml->writeAttribute('id', $_key);
         }
         // if the value is an array recurse into it
         if (is_array($value)) {
             write($xml, $value);
         } else {
             $xml->text($value);
         }
         $xml->endElement();
     }
 }
开发者ID:wave-framework,项目名称:wave,代码行数:27,代码来源:XML.php


示例2: publish

function publish($table, $menu)
{
    global $mysql;
    // get the new menu
    $section = $_POST['menu'];
    $menu = $_POST['menu'];
    $title = $_POST['title'];
    // CLEAR CURRENT TABLE
    $sql = "TRUNCATE TABLE " . $table;
    $query = $mysql->sql_query($sql);
    // INSERT NEW DATA IN THE TABLE
    $fields = array('type', 'txt_fr', 'txt_en', 'price');
    $insert = array();
    foreach ($_POST['type'] as $key => $_) {
        $item = array();
        foreach ($fields as $field) {
            $var = $_POST[$field][$key];
            $value = $var ? '\'' . mysqli_real_escape_string($mysql->cndb, stripslashes($var)) . '\'' : 'NULL';
            array_push($item, $value);
        }
        array_push($insert, '(' . implode(',', $item) . ')');
    }
    $sql = 'INSERT INTO ' . $table . ' (' . implode(',', $fields) . ') VALUES ' . implode(',', $insert) . ';';
    $query = $mysql->sql_query($sql);
    write($table, 2);
    save($table, $menu);
}
开发者ID:Razinsky,项目名称:echaude-com,代码行数:27,代码来源:utils.save_menus.php


示例3: output

function output(array $values)
{
    foreach (LANGS as $lang) {
        if (array_key_exists($lang, $values)) {
            write($lang, $values['file'], $values['key'], $values[$lang]);
        }
    }
}
开发者ID:bloomon,项目名称:laravel-spreadsheet-lang,代码行数:8,代码来源:index.php


示例4: shutdown

function shutdown()
{
    global $socket;
    if (!empty($socket)) {
        write("QUIT");
        fclose($socket);
    }
}
开发者ID:robbiet480,项目名称:transmission-irc,代码行数:8,代码来源:transmission-irc.php


示例5: postToSlack

function postToSlack($message)
{
    $slackHookUrl = env('SLACK_HOOK_URL');
    if (!empty($slackHookUrl)) {
        runLocally('curl -s -S -X POST --data-urlencode payload="{\\"channel\\": \\"#' . env('SLACK_CHANNEL_NAME') . '\\", \\"username\\": \\"Release Bot\\", \\"text\\": \\"' . $message . '\\"}"' . env('SLACK_HOOK_URL'));
    } else {
        write('Configure the SLACK_HOOK_URL to post to slack');
    }
}
开发者ID:cottacush,项目名称:yii2-base-project,代码行数:9,代码来源:deploy.php


示例6: waitForPort

 public static function waitForPort($waiting_message, $ip, $port)
 {
     write($waiting_message);
     while (!self::portAlive($ip, $port)) {
         sleep(1);
         write('.');
     }
     writeln("<fg=green>Up!</fg=green> Connect at <fg=yellow>=> {$ip}:{$port}</fg=yellow>");
 }
开发者ID:ekandreas,项目名称:docker-bedrock,代码行数:9,代码来源:Helpers.php


示例7: execCurl

function execCurl($options)
{
    static $n = 1;
    $ch = curl_init('https://www.yiqihao.com/events/worldcupresult');
    curl_setopt_array($ch, $options);
    $result = curl_exec($ch);
    curl_close($ch);
    write($result);
    echo "{$n}<br/>";
    $n++;
}
开发者ID:Crocodile26,项目名称:php-1,代码行数:11,代码来源:index.php


示例8: write

function write($str)
{
    static $firstTime = true;
    if ($firstTime) {
        ob_start();
        ob_implicit_flush(false);
        $firstTime = false;
        write(str_repeat(' ', 1024 * 4));
    }
    echo $str, ob_get_clean();
    flush();
}
开发者ID:ashumeow,项目名称:json.hpack,代码行数:12,代码来源:php.php


示例9: criaXML

function criaXML($response)
{
    $xml = new XmlWriter();
    $xml->openMemory();
    $xml->startDocument('1.0', 'UTF-8');
    $xml->startElement('bvs');
    write($xml, $response);
    $xml->endElement();
    header("Content-Type:text/xml");
    echo $xml->outputMemory(true);
    die;
}
开发者ID:julianirr,项目名称:TrabalhoSD,代码行数:12,代码来源:retornoXML.php


示例10: write

 function write(IPGXMLWriter $xmlWriter, $data)
 {
     foreach ($data as $key => $value) {
         if (is_array($value)) {
             $xmlWriter->StartElement($key);
             write($xmlWriter, $value);
             $xmlWriter->EndElement($key);
             continue;
         }
         $xmlWriter->WriteElement($key, $value);
     }
 }
开发者ID:martinw0102,项目名称:ProjetSyst,代码行数:12,代码来源:system_utils.php


示例11: write

function write(XMLWriter $xml, $data)
{
    foreach ($data as $key => $value) {
        if (is_array($value)) {
            $xml->startElement($key);
            write($xml, $value);
            $xml->endElement();
            continue;
        }
        $xml->writeElement($key, $value);
    }
}
开发者ID:kaloutsa,项目名称:maksudproject,代码行数:12,代码来源:jsonxml.php


示例12: run

 function run($request)
 {
     $tables = array("ProductGroup", "ProductGroup_Live", "Product", "Product_Live");
     if (class_exists("ProductVariation")) {
         $tables[] = "ProductVariation";
     }
     //todo: make list based on buyables rather than hard-coded.
     foreach ($tables as $tableName) {
         $classErrorCount = 0;
         $removeCount = 0;
         $updateClassCount = 0;
         $rowCount = DB::query("SELECT COUNT(\"ImageID\") FROM \"{$tableName}\" WHERE ImageID > 0;")->value();
         DB::alteration_message("<h2><strong>CHECKING {$tableName} ( {$rowCount} records ):</strong></h2>");
         $rows = DB::query("SELECT \"ImageID\", \"{$tableName}\".\"ID\" FROM \"{$tableName}\" WHERE ImageID > 0;");
         if ($rows) {
             foreach ($rows as $row) {
                 $remove = false;
                 $classErrorCount += DB::query("\r\n\t\t\t\t\t\tSELECT COUNT (\"File\".\"ID\")\r\n\t\t\t\t\t\tFROM \"File\"\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\"File\".\"ID\" = " . $row["ImageID"] . "\r\n\t\t\t\t\t\t\tAND  (\r\n\t\t\t\t\t\t\t \"ClassName\" = 'Image' OR\r\n\t\t\t\t\t\t\t \"ClassName\" = 'ProductVariation_Image' OR\r\n\t\t\t\t\t\t\t \"ClassName\" = ''\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t")->value();
                 DB::query("\r\n\t\t\t\t\t\tUPDATE \"File\"\r\n\t\t\t\t\t\tSET \"ClassName\" = 'Product_Image'\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\"File\".\"ID\" = " . $row["ImageID"] . "\r\n\t\t\t\t\t\t\tAND  (\r\n\t\t\t\t\t\t\t \"ClassName\" = 'Image' OR\r\n\t\t\t\t\t\t\t \"ClassName\" = 'ProductVariation_Image' OR\r\n\t\t\t\t\t\t\t \"ClassName\" = ''\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t");
                 $image = Product_Image::get()->byID($row["ImageID"]);
                 if (!$image) {
                     $remove = true;
                 } elseif (!$image->getTag()) {
                     $remove = true;
                 }
                 if ($remove) {
                     $removeCount++;
                     DB::query("UPDATE \"{$tableName}\" SET \"ImageID\" = 0 WHERE \"{$tableName}\".\"ID\" = " . $row["ID"] . " AND \"{$tableName}\".\"ImageID\" = " . $row["ImageID"] . ";");
                 } elseif (!is_a($image, Object::getCustomClass("Product_Image"))) {
                     $updateClassCount++;
                     $image = $image->newClassInstance("Product_Image");
                     $image - write();
                 }
             }
         }
         if ($classErrorCount) {
             DB::alteration_message("<strong>{$tableName}:</strong> there were {$classErrorCount} files with the wrong class names.  These have been fixed.", "deleted");
         } else {
             DB::alteration_message("<strong>{$tableName}:</strong> there were no files with the wrong class names. ", "created");
         }
         if ($removeCount) {
             DB::alteration_message("<strong>{$tableName}:</strong> Removed {$removeCount} image(s) from products and variations because they do not exist in the file-system or database", "deleted");
         } else {
             DB::alteration_message("<strong>{$tableName}:</strong> All product images are accounted for", "created");
         }
         if ($updateClassCount) {
             DB::alteration_message("<strong>{$tableName}:</strong> {$removeCount} image(s) did not match the requirement 'instanceOF Product_Image', this has been corrected.", "deleted");
         } else {
             DB::alteration_message("<strong>{$tableName}:</strong> All product images instancesOF Product_Image", "created");
         }
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:52,代码来源:EcommerceTaskProductImageReset.php


示例13: error

function error($code)
{
    global $message, $text, $score, $timeused;
    echo $code . '\\n';
    $text = 'err';
    $message = $code . '<br>เกรดเดอร์จะหยุดทำงาน และสามารถ start grader ด้วยตัวเองได้แล้ว';
    $score = 0;
    $timeused = 0;
    degrade();
    write();
    shell_exec('sh /home/otog/otog/judge/run.sh');
    die;
}
开发者ID:bignunxd,项目名称:otog,代码行数:13,代码来源:queue.php


示例14: addRoute

 protected function addRoute($route, $class, $routes)
 {
     if (file_exists('apps/' . $class . '.php')) {
         if (empty($routes[$route])) {
             file_put_contents('configs/router_config.ini', "\n" . $route . "=" . $class, FILE_APPEND);
         } else {
             write("Error: the route '" . $route . "' already exists.");
         }
         require_once 'apps/' . $class . '.php';
         $description = $class::description();
         write('[ ' . $route . ' ] - ' . $description);
     } else {
         write("Error: the class you specified doesn't exist in apps");
     }
 }
开发者ID:recoveredvader,项目名称:NilFactorCLIFrameWork,代码行数:15,代码来源:NFAddRoute.php


示例15: run

 /**
  * @brief function handling what the script does
  */
 protected function run(&$params)
 {
     $routes = parse_ini_file('configs/router_config.ini');
     if (!empty($routes[$params[1]])) {
         unset($routes[$params[1]]);
         $data = "";
         foreach ($routes as $route => $class) {
             $data .= $route . "=" . $class . "\n";
         }
         file_put_contents('configs/router_config.ini', $data);
         write("route '" . $params[1] . "' removed.");
     } else {
         write("Error: the app you wanted to remove isn't listed in 'configs/router_config.ini'.");
     }
 }
开发者ID:recoveredvader,项目名称:NilFactorCLIFrameWork,代码行数:18,代码来源:NFDelRoute.php


示例16: template

function template($parent, $code)
{
    $template = file_get_contents(dirname(__FILE__) . DS . 'template.php');
    $filename = str_replace('\\', '/', $parent . '/' . $code);
    $file = dirname(__FILE__) . DS . 'src' . DS . "Cypher/StatusCodes{$filename}.php";
    $namespace = "EndyJasmi\\Cypher\\StatusCodes{$parent}";
    $path = "EndyJasmi\\Cypher\\StatusCodes{$parent}";
    $parent = array_pop(explode('\\', $parent));
    $error = $code;
    $template = str_replace('{namespace}', $namespace, $template);
    $template = str_replace('{path}', $path, $template);
    $template = str_replace('{parent}', $parent, $template);
    $template = str_replace('{error}', $error, $template);
    var_dump($file);
    // var_dump($template);
    write($file, $template);
}
开发者ID:nhaynes,项目名称:cypher,代码行数:17,代码来源:generate.php


示例17: getXml

function getXml($results)
{
    $xml = new XmlWriter();
    $xml->openMemory();
    $xml->setIndent(true);
    // new
    $xml->setIndentString("    ");
    // new
    $xml->startDocument('1.0', 'UTF-8');
    $xml->startElement('root');
    write($xml, $results);
    $xml->endElement();
    $xml->endDocument();
    // new
    $data = $xml->outputMemory(true);
    //$file = file_put_contents(APPPATH . '../uploads/data.xml', $data);
    return $data;
}
开发者ID:heptanol,项目名称:Test-git,代码行数:18,代码来源:test.php


示例18: write

 function write(XMLWriter $xml, $data)
 {
     foreach ($data as $key => $value) {
         if (is_array($value)) {
             if (is_numeric($key)) {
                 #The only time a numeric key would be used is if it labels an array with non-uniqe keys
                 write($xml, $value);
                 continue;
             } else {
                 $xml->startElement($key);
                 write($xml, $value);
                 $xml->endElement();
                 continue;
             }
         }
         $xml->writeElement($key, $value);
     }
 }
开发者ID:Abbe98,项目名称:ODOK,代码行数:18,代码来源:Format.php


示例19: save

function save($items, $publish)
{
    global $mysql;
    $table = 't_output_vins_admin';
    $fields = 'id_produit, parent, sys_order, type, label';
    $values = '';
    $mysql->delete_db($table, '1=1');
    foreach ($items as $item) {
        $id = $item->id;
        $parent = $item->parent;
        $order = $item->index;
        $type = $item->type;
        $label = addslashes($item->label);
        $values = "{$id}, '{$parent}', {$order}, '{$type}', '{$label}'";
        $sql = "INSERT INTO {$table} ({$fields}) values ({$values})";
        $mysql->sql_query($sql);
        if ($type == 'promo' || $type == 'vins-au-verre' || $type == 'demi-bouteilles') {
            $catvin = $item->catvin ? $item->catvin : 0;
            $regiondumonde = $item->regiondumonde ? $item->regiondumonde : 0;
            $pays = $item->pays ? $item->pays : 0;
            $region = $item->region ? $item->region : 0;
            $sousregion = $item->sousregion ? $item->sousregion : 0;
            switch ($type) {
                case 'promo':
                    $table_promo_verre = 't_promotions_admin';
                    break;
                case 'vins-au-verre':
                    $table_promo_verre = 't_output_vins_verre_admin';
                    break;
                case 'demi-bouteilles':
                    $table_promo_verre = 't_output_demi_bouteilles_admin';
                    break;
            }
            $set = "id_cat_vin={$catvin}, id_region_du_monde={$regiondumonde}, id_pays={$pays}, id_region={$region}, id_sous_region={$sousregion}";
            $where = "id={$id}";
            $mysql->update_db($table_promo_verre, $set, $where);
        }
    }
    if ($publish == 'true') {
        publish($items);
        write('t_output_vins_admin', 1);
    }
}
开发者ID:Razinsky,项目名称:echaude-com,代码行数:43,代码来源:utils.save_vins.php


示例20: index_action

 function index_action()
 {
     if (!checkfile('plugins', 0)) {
         $plugins = $this->plugin->GetPage(array('isshow' => 0));
         foreach ($plugins as $k => $v) {
             $v['isinstalled'] = 1;
             $pluginlist[] = $v;
         }
         $plugins = $this->_getAllPlugins();
         foreach ($plugins as $k => $v) {
             $v['isinstalled'] = 0;
             $pluginlist[] = $v;
         }
         write('plugins', $pluginlist);
     } else {
         $pluginlist = read('plugins');
     }
     include ROOT_PATH . '/views/admin/plugin.php';
 }
开发者ID:BGCX261,项目名称:zidan-kaka-oneplusone-svn-to-git,代码行数:19,代码来源:plugin.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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