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


PHP from函数代码示例

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


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

示例1: checkproperties

 private function checkproperties($properties)
 {
     $emptyprops = from('$property')->in($properties)->where('$property == ""')->select('$property');
     if (count($emptyprops) > 0) {
         throw new DataException('mandatoryfields');
     }
 }
开发者ID:ruffen,项目名称:Pixcel-CMS,代码行数:7,代码来源:signup.controller.php

示例2: testYourself

 public function testYourself()
 {
     // Replace the string "you_birthday" with your birthday's datestring
     $your_birthday = GigasecondTest::dateSetup("1986-03-04");
     $gs = from($your_birthday);
     $this->assertSame("2017-11-10 01:46:40", $gs->format("Y-m-d H:i:s"));
 }
开发者ID:daveyarwood,项目名称:exercism,代码行数:7,代码来源:gigasecond_test.php

示例3: indexAction

 public function indexAction()
 {
     $names = array("Daniel", "Franco", "Jose", "Maria", "Vane", "Rogelio", "Lia");
     $result = from('$name')->in($names)->where('$name => strlen($name) < 5')->select('$name');
     var_dump($result);
     exit;
 }
开发者ID:ahumadamob,项目名称:siris,代码行数:7,代码来源:TestController.php

示例4: testYourself

 public function testYourself()
 {
     $this->markTestSkipped("Skip");
     $your_birthday = GigasecondTest::dateSetup("your_birthday");
     $gs = from($your_birthday);
     $this->assertSame("2046-10-03 01:46:39", $gs->format("Y-m-d H:i:s"));
 }
开发者ID:oserbetci,项目名称:exercism.solutions,代码行数:7,代码来源:gigasecond_test.php

示例5: gen

function gen()
{
    (yield 1);
    debug_print_backtrace();
    (yield 2);
    yield from from(2);
    debug_print_backtrace();
}
开发者ID:gleamingthecube,项目名称:php,代码行数:8,代码来源:Zend_tests_generators_yield_from_backtrace.php

示例6: gen

function gen($i = 0)
{
    if ($i < 1000) {
        yield from gen(++$i);
    } else {
        (yield $i);
        yield from from(++$i);
    }
}
开发者ID:badlamer,项目名称:hhvm,代码行数:9,代码来源:yield_from_deep_recursion.php

示例7: flat_load

/**
 * Load entity
 *
 * @param array $entity
 * @param array $crit
 * @param array $opts
 *
 * @return array
 */
function flat_load(array $entity, array $crit = [], array $opts = []) : array
{
    $stmt = db()->prepare(select($entity['attr']) . from($entity['tab']) . where($crit, $entity['attr'], $opts) . order($opts['order'] ?? [], $entity['attr']) . limit($opts['limit'] ?? 0, $opts['offset'] ?? 0));
    $stmt->execute();
    if (!empty($opts['one'])) {
        return $stmt->fetch() ?: [];
    }
    return $stmt->fetchAll();
}
开发者ID:akilli,项目名称:qnd,代码行数:18,代码来源:flat.php

示例8: getZipContentsAsQueryable

function getZipContentsAsQueryable($zipFilePath)
{
    $zip = new ZipArchive();
    $zip->open($zipFilePath);
    $zipContents = [];
    for ($i = 0; $i < $zip->numFiles; $i++) {
        $zipContents[] = $zip->statIndex($i);
    }
    return from($zipContents);
}
开发者ID:eurofurence,项目名称:ef-app_backend,代码行数:10,代码来源:helpers.php

示例9: get_materia

 function get_materia($id)
 {
     $this->db->selelct('*');
     $this->db > -from('curso_materia');
     $this->db->where('id_curso', $id);
     $resultado = $this->db->get();
     if ($resultado->num_rows() > 0) {
         return $resultado->result();
     } else {
         return FALSE;
     }
 }
开发者ID:fabianazioti,项目名称:Sistema-CA,代码行数:12,代码来源:curso_model.php

示例10: index

    /**
     * Index Page action for this controller.
     *
     * Maps to the following URL
     * 		/index.php/admin/skills
     */
    public function index()
    {
        $skillCategories = $this->Categories_model->get_categories();
        $skills = $this->Portfolios_model->get_portfolios();
        $skillsByCategory = Enumerable::from($skillCategories)->orderBy('$cat ==> $cat["name"]')->groupJoin(from($skills)->orderBy('$skill ==> $skill["name"]'), '$cat ==> $cat["id"]', '$skill ==> $skill["categoryId"]', '($cat, $sks) ==> array(
	            "name" => $cat["name"],
	            "skills" => $sks
	        )');
        $this->view_bag['skillsByCategory'] = $skillsByCategory;
        $this->view_bag['title'] = 'Skills';
        $this->template->load(ADMIN_TEMPLATE_NAME, 'admin/skills/index', $this->view_bag);
    }
开发者ID:sibenye,项目名称:naijaskillhub,代码行数:18,代码来源:Portfolios.php

示例11: show

 /**
  * Default method
  */
 function show()
 {
     $this->refresh_modules_list($silent = true);
     if (main()->is_post()) {
         if (is_array($_POST['name']) && !empty($_POST['name'])) {
             $where = 'name IN("' . implode('","', _es(array_keys($_POST['name']))) . '")';
         }
         if ($_POST['activate_selected']) {
             $active = 1;
         } elseif ($_POST['disable_selected']) {
             $active = 0;
         }
         if (isset($active) && $where) {
             db()->update('admin_modules', ['active' => $active], $where);
             cache_del('admin_modules');
         }
         return js_redirect(url('/@object'));
     }
     if (!isset($this->_yf_plugins)) {
         $this->_yf_plugins = main()->_preload_plugins_list();
         $this->_yf_plugins_classes = main()->_plugins_classes;
     }
     $items = [];
     foreach ((array) from('admin_modules')->order_by('name', 'asc')->all() as $a) {
         $name = $a['name'];
         $plugin_name = '';
         if (isset($this->_yf_plugins_classes[$name])) {
             $plugin_name = $this->_yf_plugins_classes[$name];
         }
         $locations = [];
         $dir = ADMIN_MODULES_DIR;
         $places = ['framework' => ['dir' => YF_PATH . $dir, 'file' => YF_PREFIX . $name . YF_CLS_EXT], 'project' => ['dir' => ADMIN_SITE_PATH . $dir, 'file' => $name . YF_CLS_EXT], 'app' => ['dir' => APP_PATH . $dir, 'file' => $name . YF_CLS_EXT]];
         if ($plugin_name) {
             $places += ['framework_plugin' => ['dir' => YF_PATH . 'plugins/' . $plugin_name . '/' . $dir, 'file' => YF_PREFIX . $name . YF_CLS_EXT], 'project_plugin' => ['dir' => PROJECT_PATH . 'plugins/' . $plugin_name . '/' . $dir, 'file' => $name . YF_CLS_EXT], 'app_plugin' => ['dir' => APP_PATH . 'plugins/' . $plugin_name . '/' . $dir, 'file' => $name . YF_CLS_EXT]];
         }
         foreach ($places as $pname => $p) {
             $path = $p['dir'] . $p['file'];
             if (file_exists($path)) {
                 $locations[$pname] = url('/file_manager/edit/' . urlencode($path));
             }
         }
         $items[] = ['name' => $a['name'], 'active' => $a['active'], 'locations' => $locations];
     }
     css('.table .checkbox { min-height: 5px; }');
     return table($items, ['condensed' => 1, 'pager_records_on_page' => 10000, 'filter' => true, 'filter_params' => ['name' => 'like']])->form()->check_box('name', ['field_desc' => '#', 'width' => '1%'])->text('name')->func('locations', function ($field, $params, $row) {
         foreach ((array) $field as $loc => $link) {
             $out[] = '<a href="' . $link . '" class="btn btn-mini btn-xs">' . $loc . '</a>';
         }
         return implode(PHP_EOL, (array) $out);
     })->btn('conf', url('/conf_editor/admin_modules/%d'), ['id' => 'name'])->btn_active(['id' => 'name'])->footer_submit(['value' => 'activate selected'])->footer_submit(['value' => 'disable selected'])->footer_link('Refresh list', url('/@object/refresh_modules_list'), ['icon' => 'icon-refresh']);
 }
开发者ID:yfix,项目名称:yf,代码行数:54,代码来源:yf_admin_modules.class.php

示例12: gen

function gen()
{
    try {
        (yield "gen" => 0);
    } catch (Exception $e) {
        print "catch in gen()\n{$e}\n";
    }
    try {
        yield from from(0);
    } catch (Exception $e) {
        print "catch in gen()\n{$e}\n";
    }
    yield from from(2);
}
开发者ID:exakat,项目名称:exakat,代码行数:14,代码来源:_Yieldfrom.03.php

示例13: __construct

 public function __construct($params = null)
 {
     if ($params !== null && is_array($params)) {
         if (array_key_exists("from", $params)) {
             from($params["from"]);
         } elseif (array_key_exists("to", $params)) {
             to($params["to"]);
         } elseif (array_key_exists("header", $params)) {
             header($params["header"]);
         } elseif (array_key_exists("text", $params)) {
             text($params["text"]);
         } elseif (array_key_exists("subject", $params)) {
             subject($params["subject"]);
         }
     }
     return $this;
 }
开发者ID:fozeek,项目名称:framework,代码行数:17,代码来源:Mail.php

示例14: _filter_form_balance

 /**
  */
 function _filter_form_balance($filter, $replace)
 {
     $order_fields = [];
     foreach (explode('|', 'operation_id|datetime_update|datetime_start|datetime_finish|title|amount|balance') as $f) {
         $order_fields[$f] = $f;
     }
     $payment_api = _class('payment_api');
     $providers = $payment_api->provider();
     $providers__select_box = [];
     foreach ($providers as $id => $item) {
         $providers__select_box[$id] = $item['title'];
     }
     $payment_status = $payment_api->get_status();
     $payment_status__select_box = [];
     $payment_status__select_box[-1] = 'ВСЕ СТАТУСЫ';
     foreach ($payment_status as $id => $item) {
         $payment_status__select_box[$id] = $item['title'];
     }
     $min_date = from('payment_account')->one('UNIX_TIMESTAMP(MIN(datetime_create))');
     return form($replace, ['filter' => true, 'selected' => $filter])->hidden('user_id')->hidden('account_id')->text('operation_id', 'Номер операции')->text('title', 'Название')->select_box('status_id', $payment_status__select_box, ['show_text' => 'статус', 'desc' => 'Статус'])->select_box('provider_id', $providers__select_box, ['show_text' => 'провайдер', 'desc' => 'Провайдер'])->radio_box('direction', ['' => 'все', 'in' => 'приход', 'out' => 'расход'], ['desc' => 'Направление'])->daterange('datetime_update', ['format' => 'YYYY-MM-DD', 'min_date' => date('Y-m-d', $min_date ?: time() - 86400 * 30), 'max_date' => date('Y-m-d', time() + 86400), 'autocomplete' => 'off', 'desc' => 'Дата обновления', 'no_label' => 1])->select_box('order_by', $order_fields, ['show_text' => 1, 'desc' => 'Сортировка'])->radio_box('order_direction', ['asc' => 'прямой', 'desc' => 'обратный'], ['desc' => 'Направление сортировки'])->save_and_clear();
 }
开发者ID:yfix,项目名称:yf,代码行数:23,代码来源:yf_manage_payment.class.php

示例15: send_mail_multipart

function send_mail_multipart($from, $from_address, $to, $to_address, $subject, $body_plain, $body_html, $charset)
{
    global $emailAnnounce;
    $body_html = add_host_to_urls($body_html);
    if (count($to_address) > 1) {
        if (isset($emailAnnounce)) {
            if (empty($to)) {
                $to_header = $emailAnnounce;
            } else {
                $to_header = $to . " <{$emailAnnounce}>";
            }
        } else {
            if (empty($to)) {
                $to_header = '(undisclosed recipients)';
            } else {
                $to_header = "({$to})";
            }
        }
        $bcc = 'Bcc: ' . join(', ', $to_address) . PHP_EOL;
    } else {
        if (empty($to)) {
            if (is_array($to_address)) {
                $to_header = $to_address[0];
            } else {
                $to_header = $to_address;
            }
        } else {
            if (is_array($to_address)) {
                $to_header = qencode($to, $charset) . " <{$to_address[0]}>";
            } else {
                $to_header = qencode($to, $charset) . " <{$to_address}>";
            }
        }
        $bcc = '';
    }
    $separator = uniqid('==eClass-Multipart_Boundary_0_', true) . '_' . md5(time());
    $headers = from($from, $from_address) . $bcc . "MIME-Version: 1.0" . PHP_EOL . "Content-Type: multipart/alternative;" . PHP_EOL . "    boundary=\"{$separator}\"" . reply_to($from, $from_address);
    $body = "This is a multi-part message in MIME format." . PHP_EOL . PHP_EOL . "--{$separator}" . PHP_EOL . "Content-Type: text/plain; charset={$charset}" . PHP_EOL . "Content-Transfer-Encoding: 8bit\n\n{$body_plain}" . PHP_EOL . PHP_EOL . "--{$separator}" . PHP_EOL . "Content-Type: text/html; charset={$charset}" . PHP_EOL . "Content-Transfer-Encoding: 8bit" . PHP_EOL . PHP_EOL . "<html><head><meta http-equiv='Content-Type' " . "content='text/html; charset=\"{$charset}\"'>" . "<title>message</title></head><body>\n" . "{$body_html}\n</body></html>" . PHP_EOL . "--{$separator}--" . PHP_EOL;
    return @mail($to_header, qencode($subject, $charset), $body, $headers);
}
开发者ID:kostastzo,项目名称:openeclass,代码行数:40,代码来源:sendMail.inc.php


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