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


PHP init函数代码示例

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


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

示例1: create_DOM

function create_DOM()
{
    $name = config\platform::name;
    $charset = config\platform::charset;
    //get init script location
    $init_script_location = 'client/init.js';
    //get init script
    $init_script = init();
    $dom = new DOMDocument('1.0', 'utf-8');
    $dom->loadHTML('
        <!DOCTYPE html>
        <html>
            <head>
                <title>' . $name . '</title>
                <meta charset="' . $charset . '">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
            </head>
            <body>
                ' . $init_script . '
            </body>
        </html>
    ');
    ob_start();
    echo add_external_libs();
    echo $dom->saveHTML($dom->getElementsByTagName('!DOCTYPE html')->item(0));
    ob_end_flush();
}
开发者ID:guillaum3f,项目名称:codie,代码行数:27,代码来源:dom.php

示例2: process

function process($form_data)
{
    $a = session_id();
    include "connect.php";
    $conn = init($_SESSION["permission_type"]);
    $query = "\n\t\t\t\tSELECT salesrecord.cost, salesrecord.sale_price, salesrecord.transport_price FROM `salesrecord` \n\t\t\t\tinner join contract on contract.id=salesrecord.contract_id\n\t\t\t\tinner join user on contract.user_id=user.id\n\t\t\t\tOrder by salesrecord.date\n\t\t\t";
    if (isset($form_data['choosenuser']) && $form_data['choosenuser'] != "") {
        $query = "\n\t\t\t\tSELECT salesrecord.cost, salesrecord.sale_price, salesrecord.transport_price FROM `salesrecord` \n\t\t\t\tinner join contract on contract.id=salesrecord.contract_id\n\t\t\t\tinner join user on contract.user_id=user.id\n\t\t\t\tWhere user.name = '" . $form_data['choosenuser'] . "'\n\t\t\t\tOrder by salesrecord.date\n\t\t\t\t";
    }
    $result = $conn->query($query);
    $rows = $result->fetch_all(MYSQLI_ASSOC);
    $stat = array();
    $i = 0;
    $sum = 0;
    foreach ($rows as $column) {
        $i += 1;
        if ($i == 100) {
            $stat[] = $sum / 100;
            $i = 0;
            $sum = 0;
        }
        $sum += floatval($column['sale_price']) / (floatval($column['cost']) + floatval($column['transport_price']));
        //echo (   $hh . "<br>"   );
    }
    $stat[] = $sum / $i;
    echo json_encode(array("stat" => $stat));
}
开发者ID:itmashalov,项目名称:Database-Systems-Food-Project,代码行数:27,代码来源:getCeoChart.php

示例3: delete

 public static function delete($key)
 {
     self:
     init();
     $ret = self::$pool->delete($key);
     return $ret;
 }
开发者ID:zhangjingpu,项目名称:yaf-lib,代码行数:7,代码来源:Memcache.php

示例4: process

function process($form_data)
{
    include "Helper.php";
    // pretty_print_array($form_data);
    $a = session_id();
    include "connect.php";
    $conn = init($_SESSION["permission_type"]);
    $result = array();
    if (isset($form_data["transportoffer---relation"])) {
        $result = deleteTransportOffer($form_data, $conn);
    } else {
        if (isset($form_data["user---relation"])) {
            $result = deleteUser($form_data, $conn);
        } else {
            if (isset($form_data["contract---relation"])) {
                $result = deleteContract($form_data, $conn);
            } else {
                if (isset($form_data["market---relation"])) {
                    $result = deleteMarket($form_data, $conn);
                } else {
                    if (isset($form_data["transportoffer---relation"])) {
                        $result = deleteTransportOffer($form_data, $conn);
                    } else {
                        if (isset($form_data["immigrants---relation"])) {
                            $result = deleteImigrants($form_data, $conn);
                        } else {
                            if (isset($form_data["product---relation"])) {
                                $result = deleteProduct($form_data, $conn);
                            } else {
                                if (isset($form_data["transportcompany---relation"])) {
                                    $result = deleteTransportCompany($form_data, $conn);
                                } else {
                                    if (isset($form_data["flavour---relation"])) {
                                        $result = deleteTaste($form_data, $conn);
                                    } else {
                                        if (isset($form_data["storagetype---relation"])) {
                                            $result = deleteStoragetype($form_data, $conn);
                                        } else {
                                            if (isset($form_data["country---relation"])) {
                                                $result = deleteCountry($form_data, $conn);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if ($result["error"] == "") {
        $returnedData = $conn->query($result["data"]);
    }
    if ($conn->connect_errno) {
        $result["error"] = $conn->connect_error;
    }
    $result["data"] = "";
    echo json_encode($result);
}
开发者ID:itmashalov,项目名称:Database-Systems-Food-Project,代码行数:60,代码来源:ActionDelete.php

示例5: compare

function compare()
{
    init();
    //如果目标数据库不存在,先创建一个
    $sql = 'create database if not exists ' . TARGET_DB . ' default charset utf8 collate utf8_general_ci';
    mysql_query($sql, TARGET_LINK);
    //获取数据源的数据结构
    $source_database_struct = get_database_struct(SOURCE_LINK, SOURCE_DB);
    //获取目标的数据结构
    $target_database_struct = get_database_struct(TARGET_LINK, TARGET_DB);
    //以数据源为准,比较差异
    foreach ($source_database_struct as $table_name => $create_table) {
        if (!$target_database_struct[$table_name]) {
            execute($create_table, TARGET_LINK);
        } else {
            //比较字段
            compare_column(SOURCE_LINK, TARGET_LINK, SOURCE_DB, TARGET_DB, $table_name);
            //比较索引
            compare_keys(SOURCE_LINK, TARGET_LINK, SOURCE_DB, TARGET_DB, $table_name);
            //比较分区
            compare_partition(SOURCE_LINK, TARGET_LINK, SOURCE_DB, TARGET_DB, $table_name);
        }
    }
    //删除多余的表
    foreach ($target_database_struct as $table_name => $create_table) {
        if (!$source_database_struct[$table_name]) {
            $sql = 'drop table ' . $table_name;
            execute($sql, TARGET_LINK);
        }
    }
    close();
}
开发者ID:bluefan,项目名称:phpsource,代码行数:32,代码来源:mysql_update.php

示例6: event

 public static function event()
 {
     $cmd = geolocCmd::byId(init('id'));
     if (!is_object($cmd)) {
         throw new Exception(__('Commande ID geoloc inconnu : ', __FILE__) . init('id'));
     }
     if ($cmd->getEqLogic()->getEqType_name() != 'geoloc') {
         throw new Exception(__('Cette commande n\'est pas de type geoloc : ', __FILE__) . init('id'));
     }
     if ($cmd->getConfiguration('mode') != 'dynamic') {
         throw new Exception(__('Cette commande de géoloc n\'est pas dynamique : ', __FILE__) . init('id'));
     }
     $value = init('value');
     if (strpos($value, 'https://') !== false || strpos($value, 'http://') !== false) {
         $url = parse_url($value);
         parse_str($url['query'], $output);
         if (isset($output['q'])) {
             $value = $output['q'];
         }
         if (isset($output['ll'])) {
             $value = $output['ll'];
         }
     }
     //For compatibility with older version which not use the Value property, set the Value if needed
     foreach ($cmd->getEqLogic()->getCmd('info') as $distance) {
         if ($distance->getConfiguration('mode') == 'distance' || $distance->getConfiguration('mode') == 'travelDistance' || $distance->getConfiguration('mode') == 'travelTime') {
             if ($distance->setDependency()) {
                 $distance->save();
             }
         }
     }
     $cmd->event($value);
     $cmd->getEqLogic()->refreshWidget();
 }
开发者ID:DavZero,项目名称:plugin-geoloc,代码行数:34,代码来源:geoloc.class.php

示例7: userPage

function userPage($modx)
{
    init($modx);
    $myuser = $modx->getObject('kofcuser', array('name' => $modx->user->username), false);
    if ($myuser) {
        $addr = $myuser->getMany('memberMemberAddress', array('addressType' => 'home'));
        foreach ($addr as $a) {
            echo $a->get('street1');
        }
        /*
        	$addr=$modx->newObject('memberAddress');
        	$addr->fromArray(array('addressType'=>'home','street1' => '412 Crofton Park Lane' ,'city'=>'Franklin','state'=>'TN','zip'=>'37069'));
        	$myuser->addMany($addr);
        $myuser->save();
        */
        $baseImage = '/assets/images/memberPhotos/';
        if ($myuser) {
            $imagePath = $baseImage . $myuser->get('imagePath');
        }
        //$mycouncil=$modx->getObject('council',array('id'=>$myuser->get('councilId')));
        $mycouncil = $myuser->getOne('memberCouncil');
        $modx->toPlaceholders(array("imagePath" => $imagePath), '');
        $modx->toPlaceholders($myuser->toArray(), 'member');
        $modx->toPlaceholders($mycouncil->toArray(), 'council');
    }
    return null;
}
开发者ID:jakewoodstn,项目名称:kofctnComponent,代码行数:27,代码来源:snippet.kofctn.php

示例8: process

function process($form_data)
{
    $a = session_id();
    include "connect.php";
    $conn = init($_SESSION["permission_type"]);
    include "Helper.php";
    //pretty_print_array($form_data);
    $processed_form_data = preprocess($form_data);
    $builder = new GetQueryBuilder();
    $coolresult = $builder->generateSQL($processed_form_data);
    $returnedData = "";
    //print_r($coolresult);
    $returnedData = $conn->query($coolresult["data"][0]);
    //echo ($coolresult["data"][0]);
    $coolresult["data"] = "";
    if ($conn->error) {
        if ($coolresult["error"] == "") {
            $coolresult["error"] = $conn->error;
        }
    } else {
        $coolresult["error"] = "";
        $coolresult["data"] = $returnedData->fetch_all(MYSQLI_ASSOC);
    }
    echo json_encode($coolresult);
}
开发者ID:itmashalov,项目名称:Database-Systems-Food-Project,代码行数:25,代码来源:ActionGet.php

示例9: event

 public static function event()
 {
     $cmd = iftttCmd::byId(init('id'));
     if (!is_object($cmd)) {
         throw new Exception('Commande ID ifttt inconnu : ' . init('id'));
     }
     $cmd->event(init('value'));
 }
开发者ID:jeedom,项目名称:plugin-ifttt,代码行数:8,代码来源:ifttt.class.php

示例10: getCodecheckProductBySearch

function getCodecheckProductBySearch($suchbegriff)
{
    $ean = preg_replace('/[^a-zA-Z-0-9]+/', '', $suchbegriff);
    $context = init();
    $r = file_get_contents('http://www.codecheck.info/WebService/rest/prod/search/0/0/30/' . $suchbegriff, false, $context);
    $r = json_decode($r);
    return $r->result;
}
开发者ID:RaphaelManke,项目名称:chefkochWrapperToRDF,代码行数:8,代码来源:codecheck.php

示例11: test_init

 /** 
  * Test initialization method.
  */
 public function test_init()
 {
     // Setup
     \WP_Mock::expectAction('wpd_tools_init');
     // Act
     init();
     // Verify
     $this->assertConditionsMet();
 }
开发者ID:lkwdwrd,项目名称:wp-doc-tools,代码行数:12,代码来源:Core_Tests.php

示例12: main

function main()
{
    if ($_SERVER['argc'] <= 1 || false === is_dir($_SERVER['argv'][1])) {
        echo usage();
        exit(-1);
    } else {
        setup();
        init($_SERVER['argv'][1]);
    }
}
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:10,代码来源:runner.php

示例13: main

function main()
{
    init();
    connect();
    switch ($GLOBALS['req']['a']) {
        case 'getMembers':
            display('members', getMembers());
            break;
    }
    echo json_encode($GLOBALS['final_print']);
    disconnect();
}
开发者ID:armsnyder,项目名称:bonehead-site,代码行数:12,代码来源:misc.php

示例14: generate

function generate()
{
    init();
    $sql = 'SHOW TABLES';
    $ret = QueryExecutor::execute(new SqlQuery($sql));
    getnerateDomainObjects($ret);
    getnerateDAOObjects($ret);
    getnerateDAOExtObjects($ret);
    getnerateIDAOObjects($ret);
    createIncludeFile($ret);
    createDAOFactory($ret);
}
开发者ID:acapps,项目名称:phpdao-for-me,代码行数:12,代码来源:generate.php

示例15: init

/**
 * Grab and push test email data into redis
 * @param $limit_rounds number of times function will execute recursively
 * @param $time_between_rounds number of seconds between each recursive round.
 */
function init($limit_rounds = 10, $time_between_rounds = 5)
{
    $limit_rounds--;
    $email_data_array = json_decode(exec('node test/make-test-data.js 100'));
    foreach ($email_data_array as $key => $email_data_item) {
        queue_email($email_data_item, rand(0, 10));
    }
    if ($limit_rounds > 0) {
        echo "queue_email sleeping. Rounds left: {$limit_rounds}.";
        sleep($time_between_rounds);
        init($limit_rounds);
    }
}
开发者ID:keeganbrown,项目名称:node-redis-priority-mail-queue,代码行数:18,代码来源:queue_email.php


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