本文整理汇总了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');
}
}
示例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"));
}
示例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;
}
示例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"));
}
示例5: gen
function gen()
{
(yield 1);
debug_print_backtrace();
(yield 2);
yield from from(2);
debug_print_backtrace();
}
示例6: gen
function gen($i = 0)
{
if ($i < 1000) {
yield from gen(++$i);
} else {
(yield $i);
yield from from(++$i);
}
}
示例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();
}
示例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);
}
示例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;
}
}
示例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);
}
示例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']);
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}