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

PHP from函数代码示例

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

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



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


示例16: preview

 /**
  */
 function preview($extra = [])
 {
     conf('ROBOTS_NO_INDEX', true);
     no_graphics(true);
     if (main()->USER_ID != 1) {
         return print _403('You should be logged as user 1');
     }
     // Example of url: /dynamic/preview/static_pages/29/
     $object = preg_replace('~[^a-z0-9_]+~ims', '', $_GET['id']);
     $id = preg_replace('~[^a-z0-9_]+~ims', '', $_GET['page']);
     if (!strlen($object)) {
         return print _403('Object is required');
     }
     $ref = $_SERVER['HTTP_REFERER'];
     $body = '';
     if (is_post() && isset($_POST['text'])) {
         $u_ref = parse_url($ref);
         $u_self = parse_url(WEB_PATH);
         $u_adm = parse_url(ADMIN_WEB_PATH);
         if ($u_ref['host'] && $u_ref['host'] == $u_self['host'] && $u_ref['host'] == $u_adm['host'] && $u_ref['path'] == $u_adm['path']) {
             $body = $_POST['text'];
         } else {
             return print _403('Preview security check not passed');
         }
     }
     if (!$body) {
         $q = from($object)->whereid($id);
         if ($object == 'static_pages') {
             $body = $q->one('text');
         } elseif ($object == 'tips') {
             $body = $q->one('text');
         } elseif ($object == 'faq') {
             $body = $q->one('text');
         } elseif ($object == 'news') {
             $body = $q->one('full_text');
         }
     }
     $body = '<div class="container">' . $body . '</div>';
     return print common()->show_empty_page($body);
 }
开发者ID:yfix,项目名称:yf,代码行数:42,代码来源:yf_dynamic_preview.class.php


示例17: setAccess

 public function setAccess($object, $access)
 {
     if ($object instanceof Module) {
         if ($access) {
             $this->moduleaccess[$object->getId()] = $access;
         } else {
             if (isset($this->moduleaccess[$object->getId()])) {
                 unset($this->moduleaccess[$object->getId()]);
             }
         }
     } else {
         if ($object instanceof Right) {
             if ($access) {
                 $this->rights[$object->getId()] = $access;
             } else {
                 if (isset($this->rights[$object->getId()])) {
                     unset($this->rights[$object->getId()]);
                 }
             }
         } else {
             if ($object instanceof Site) {
                 if ($access) {
                     $sites = from('$site')->in($this->sites)->where('$site => $site->getId() == ' . $object->getId())->select('$site');
                     if (count($sites) == 0) {
                         $this->sites[] = $object;
                     }
                 } else {
                     $sites = from('$site')->in($this->sites)->where('$site => $site->getId() != ' . $object->getId())->select('$site');
                     $this->sites = $sites;
                 }
             } else {
                 throw new DataException('wrongtype');
             }
         }
     }
 }
开发者ID:ruffen,项目名称:Pixcel-CMS,代码行数:36,代码来源:role.asset.php


示例18: runForm

 protected function runForm()
 {
     if (from($_REQUEST, 'user_name') && from($_REQUEST, 'user_password')) {
         $this->install();
         $this->saveConfigs();
         $_SESSION[$this->siteUrl]["user"] = $this->user;
         return true;
     } else {
         unset($_SESSION[$this->siteUrl]["user"]);
         return false;
     }
 }
开发者ID:pianove,项目名称:htmly-installer,代码行数:12,代码来源:Settings.php


示例19: _show_quick_filter

 /**
  */
 function _show_quick_filter()
 {
     $a = [];
     $status_names = from('payment_status')->get_2d('status_id, title');
     $count_by_status = select(['status_id', 'COUNT(*) AS num'])->from('payment_operation')->where('direction', '=', 'in')->group_by('status_id')->get_2d();
     $statuses_display = [1 => 'text-warning', 2 => 'text-success', 5 => 'text-warning', 3 => 'text-danger', 6 => 'text-danger', 4 => 'text-muted', 7 => 'text-info'];
     foreach ((array) $statuses_display as $status_id => $css_class) {
         if ($count_by_status[$status_id]) {
             $name = $status_names[$status_id];
             $a[] = a('/@object/filter_save/clear/?filter=status_id:' . $status_id, $name, 'fa fa-filter', $name, $css_class, '');
         }
     }
     $a[] = a('/@object/filter_save/clear/', 'Clear filter', 'fa fa-close', '', '', '');
     return $a ? '<div class="pull-right">' . implode(PHP_EOL, $a) . '</div>' : '';
 }
开发者ID:yfix,项目名称:yf,代码行数:17,代码来源:yf_manage_deposit.class.php


示例20: return

<?php

return (array) from('timezones')->where('active', '1')->order_by('seconds ASC', 'name ASC')->all();
开发者ID:yfix,项目名称:yf,代码行数:3,代码来源:timezones.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP fromDBDate函数代码示例发布时间:2022-05-15
下一篇:
PHP frmElements函数代码示例发布时间: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