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

PHP endsWith函数代码示例

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

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



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

示例1: getstats

function getstats($completed)
{
    foreach ($completed as $fname) {
        if (endsWith($fname, ".txt")) {
        }
    }
}
开发者ID:andrewbredow,项目名称:IAT,代码行数:7,代码来源:fileManager.php


示例2: env

 /**
  * Gets the value of an environment variable. Supports boolean, empty and null.
  *
  * @param  string  $key
  * @param  mixed   $default
  * @return mixed
  */
 function env($key, $default = null)
 {
     $value = getenv($key);
     if ($value === false) {
         return value($default);
     }
     switch (strtolower($value)) {
         case 'true':
         case '(true)':
             return true;
         case 'false':
         case '(false)':
             return false;
         case 'empty':
         case '(empty)':
             return '';
         case 'null':
         case '(null)':
             return;
     }
     if (startsWith($value, '"') && endsWith($value, '"')) {
         return substr($value, 1, -1);
     }
     return $value;
 }
开发者ID:atasciuc,项目名称:zend-expressive-validation,代码行数:32,代码来源:helpers.php


示例3: setup_database

function setup_database($new = false)
{
    global $MYSQL_SERVER;
    global $MYSQL_USER;
    global $MYSQL_PASSWORD;
    global $MYSQL_DATABASE;
    echo "= DATABASE SETUP =" . PHP_EOL . PHP_EOL;
    $conn = mysql_connect($MYSQL_SERVER, $MYSQL_USER, $MYSQL_PASSWORD);
    if ($new) {
        mysql_query("DROP DATABASE {$MYSQL_DATABASE}");
        echo "Database {$database} dropped." . PHP_EOL;
    }
    mysql_query("CREATE DATABASE IF NOT EXISTS {$MYSQL_DATABASE}") or die(mysql_error());
    echo "Database {$MYSQL_DATABASE} created." . PHP_EOL;
    mysql_select_db($MYSQL_DATABASE, $conn);
    mysql_set_charset("utf8");
    if ($new) {
        $dir = "database/";
        if (is_dir($dir)) {
            if ($handle = opendir($dir)) {
                while (false !== ($file = readdir($handle))) {
                    if (!is_dir($file) && !endsWith($file, "_inserts.sql")) {
                        create_table($file);
                    }
                }
            }
        }
        insert_languages();
        echo "Tables for {$MYSQL_DATABASE} created." . PHP_EOL;
    }
}
开发者ID:asavagar,项目名称:EU-data-cloud,代码行数:31,代码来源:functions.php


示例4: loadFiles

    public static function loadFiles($path)
    {
        if (endsWith($path, "dashboard")) {
            $css = "dashboard.wolf.css";
            if (Setting::get("theme") === "fox_theme") {
                $css = "dashboard.fox.css";
            } else {
                if (Setting::get("theme") === "wordpress-3.8") {
                    $css = "dashboard.wordpress.css";
                }
            }
            $file = PATH_PUBLIC . "wolf/plugins/dashboard/system/css/" . $css;
            ?>
<link rel="stylesheet" type="text/css" href="<?php 
            echo $file;
            ?>
" media="screen" /><?php 
            Observer::notify("dashboard_load_css");
            $file = PATH_PUBLIC . "wolf/plugins/dashboard/system/js/script.dashboard.js";
            ?>
<script type="text/javascript" language="javascript" src="<?php 
            echo $file;
            ?>
"></script><?php 
            Observer::notify("dashboard_load_js");
        }
    }
开发者ID:pawedWolf,项目名称:wolfcms-dashboard,代码行数:27,代码来源:DashboardController.php


示例5: percentToDecimal

function percentToDecimal($percent)
{
    if (endsWith($percent, '%')) {
        return rtrim($percent, "%") / 100;
    }
    return $percent;
}
开发者ID:global-dynamics,项目名称:SARAH-framework,代码行数:7,代码来源:_numbers.php


示例6: setTemplatePath

 /**
  * 
  * @param string $template
  * @throws \InvalidArgumentException
  */
 public function setTemplatePath($template)
 {
     if (!endsWith($template, ".mustache")) {
         throw new \InvalidArgumentException("O arquivo de template do email deve ser do tipo .mustache");
     }
     $this->template = $template;
 }
开发者ID:diego3,项目名称:myframework-core,代码行数:12,代码来源:EmailHtml.php


示例7: _identify

 function _identify($str)
 {
     $msg_identifier = "]8úü";
     $server_delivery_identifier = "Œ";
     $client_delivery_identifier = "½­";
     $acc_info_iden = "™½§”";
     $last_seen_ident = "H8úü";
     $last_seen_ident2 = "{½L‹";
     if (startsWith($str, $msg_identifier, 3)) {
         if (endsWith($str, $server_delivery_identifier)) {
             return 'server_delivery_report';
         } else {
             if (endsWith($str, $client_delivery_identifier)) {
                 return 'client_delivery_report';
             } else {
                 return 'msg';
             }
         }
     } else {
         if (startsWith($str, $acc_info_iden, 3)) {
             return 'account_info';
         } else {
             if (startsWith($str, $last_seen_ident, 3) && strpos($str, $last_seen_ident2)) {
                 return 'last_seen';
             }
         }
     }
 }
开发者ID:rprados,项目名称:WhatsAPI,代码行数:28,代码来源:whatsapp.v2.php


示例8: __construct

 function __construct($password = NULL, $host = "127.0.0.1", $port = 10010)
 {
     $this->socket = stream_socket_client("udp://" . $host . ":" . $port, $errorno, $errorstr);
     if (!$this->socket) {
         die("Failed to connect, Error #{$errorno}: {$errorstr}");
     }
     fwrite($this->socket, Bencode::encode(array("q" => "ping")));
     // Try to ping it
     $returndata = fread($this->socket, $this->buffersize);
     if (!endsWith($returndata, "1:q4:ponge")) {
         die("{$returndata}");
     }
     $this->password = $password;
     $page = 0;
     while (True) {
         $request = array("q" => "Admin_availableFunctions", "args" => array("page" => $page));
         fwrite($this->socket, Bencode::encode($request));
         $result = Bencode::decode(fread($this->socket, $this->buffersize));
         foreach ($result['availableFunctions'] as $function => $description) {
             $this->functions[$function] = $description;
         }
         if (isset($result['more'])) {
             $page++;
         } else {
             break;
         }
     }
 }
开发者ID:defual,项目名称:cjdns,代码行数:28,代码来源:Cjdns.php


示例9: add_edge

 function add_edge($_previous_as, $_as, $attrs = array())
 {
     global $edges, $graph;
     $edge_array = array($_previous_as => $_as);
     if (!array_key_exists(gek($_previous_as, $_as), $edges)) {
         $attrs['splines'] = "true";
         $edge = array($edge_array, $attrs);
         $graph->addEdge($edge_array, $attrs);
         $edges[gek($_previous_as, $_as)] = $edge;
     } else {
         if (array_key_exists('label', $attrs)) {
             $e =& $edges[gek($_previous_as, $_as)];
             $label_without_star = str_replace("*", "", $attrs['label']);
             $labels = explode("\r", $e[1]['label']);
             if (!in_array($label_without_star . "*", $labels)) {
                 $tmp_labels = array();
                 foreach ($labels as $l) {
                     if (!startsWith($l, $label_without_star)) {
                         $labels[] = $l;
                     }
                 }
                 $labels = array_merge(array($attrs['label']), $tmp_labels);
                 $cmp = function ($a, $b) {
                     return endsWith($a, "*") ? -1 : 1;
                 };
                 usort($labels, $cmp);
                 $label = escape(implode("\r", $labels));
                 $e[1]['label'] = $label;
             }
         }
     }
     return $edges[gek($_previous_as, $_as)];
 }
开发者ID:novag,项目名称:LookingGlass,代码行数:33,代码来源:map.php


示例10: getFolderNameFromPath

function getFolderNameFromPath($path)
{
    if (endsWith("/", $path)) {
        $path = substr($path, 0, -1);
    }
    return substr($path, strrpos($path, "/") + 1);
}
开发者ID:nikcorg,项目名称:simplegallery,代码行数:7,代码来源:helpers.php


示例11: __construct

 public function __construct(WebRequest $request)
 {
     parent::__construct($request);
     global $IP;
     if (strpos($this->mOid, '..') !== false) {
         throw new Exception('File path must not contain \'..\'.');
     }
     if (endsWith($this->mOid, '.js', false)) {
         $this->mContentType = AssetsManager::TYPE_JS;
     } else {
         if (endsWith($this->mOid, '.css', false)) {
             $this->mContentType = AssetsManager::TYPE_CSS;
         } else {
             throw new Exception('Requested file must be .css or .js.');
         }
     }
     $filePath = $IP . '/' . $this->mOid;
     if (file_exists($filePath)) {
         $this->mContent = file_get_contents($filePath);
     } else {
         $requestDetails = AssetsManager::getRequestDetails();
         Wikia::log(__METHOD__, false, "file '{$filePath}' doesn't exist ({$requestDetails})", true);
         throw new Exception('File does not exist');
     }
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:AssetsManagerOneBuilder.class.php


示例12: pugpig_validate_file

function pugpig_validate_file($file, $mime)
{
    // CHECK UTF-8??
    if (!file_exists($file)) {
        return "No file";
    }
    if (FALSE) {
        return "File encoding is not UTF-8";
    }
    // Check XML
    if (strpos($mime, 'xml') !== FALSE || endsWith($file, '.xml')) {
        $f = file_get_contents($file);
        return check_xml_is_valid($f);
    }
    // Check JSON
    if (startsWith($mime, 'application/json') || endsWith($file, '.json')) {
        $f = file_get_contents($file);
        $json = json_decode($f);
        $err = json_last_error();
        if ($err == JSON_ERROR_NONE) {
            return "";
        }
        return "Error: {$err}";
    }
    // Check Manifests
    if (startsWith($mime, 'text/cache-manifest') || endsWith($file, '.manifest') || endsWith($file, '.appcache')) {
        $f = file_get_contents($file);
        if (!startsWith($f, "CACHE MANIFEST")) {
            return "Manifest did not start with CACHE Manifest. Instead got:\n{$f}";
        }
    }
    return "";
}
开发者ID:shortlist-digital,项目名称:agreable-pugpig-plugin,代码行数:33,代码来源:pugpig_packager_helpers.php


示例13: normalize

 private function normalize($path)
 {
     if (!endsWith($path, '/')) {
         $path .= '/';
     }
     return $path;
 }
开发者ID:kyhfan,项目名称:belif_cushion,代码行数:7,代码来源:FileBrowser.php


示例14: validateHtmlTag

function validateHtmlTag($html)
{
    $result = array();
    $result[] = strpos($html, '<html>');
    $result[] = endsWith($html, '</html>');
    return $result;
}
开发者ID:jobhenkens,项目名称:web-backend-oplossingen,代码行数:7,代码来源:functies2b.php


示例15: showHeaders

function showHeaders()
{
    ?>
    <html>
        <head>
            <meta charset="utf-8" /> 
            <?php 
    $m_data = new application\model\M_Data();
    //$array = $m_data->listFolderFiles("assets");
    $array = $m_data->directoryToArray("assets", true);
    foreach ($array as $key => $value) {
        if (endsWith($value, ".js")) {
            ?>
                    <script src="<?php 
            echo base_url($value);
            ?>
"></script>
                    <?php 
        } elseif (endsWith($value, ".css")) {
            ?>
                    <link href="<?php 
            echo base_url($value);
            ?>
" rel="stylesheet">
                    <?php 
        }
    }
    ?>
        </head>
        <body>
            <?php 
}
开发者ID:GunB,项目名称:PHP_AdminBasic,代码行数:32,代码来源:V_Base.php


示例16: onPageRequest

 public function onPageRequest(PageRequestEvent $event)
 {
     global $config, $page;
     // hax.
     if ($page->mode == "page" && (!isset($page->blocks) || $this->count_main($page->blocks) == 0)) {
         $h_pagename = html_escape(implode('/', $event->args));
         $f_pagename = preg_replace("/[^a-z_\\-\\.]+/", "_", $h_pagename);
         $theme_name = $config->get_string("theme", "default");
         if (file_exists("themes/{$theme_name}/{$f_pagename}") || file_exists("lib/static/{$f_pagename}")) {
             $filename = file_exists("themes/{$theme_name}/{$f_pagename}") ? "themes/{$theme_name}/{$f_pagename}" : "lib/static/{$f_pagename}";
             $page->add_http_header("Cache-control: public, max-age=600");
             $page->add_http_header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 600) . ' GMT');
             $page->set_mode("data");
             $page->set_data(file_get_contents($filename));
             if (endsWith($filename, ".ico")) {
                 $page->set_type("image/x-icon");
             }
             if (endsWith($filename, ".png")) {
                 $page->set_type("image/png");
             }
             if (endsWith($filename, ".txt")) {
                 $page->set_type("text/plain");
             }
         } else {
             log_debug("handle_404", "Hit 404: {$h_pagename}");
             $page->set_code(404);
             $page->set_title("404");
             $page->set_heading("404 - No Handler Found");
             $page->add_block(new NavBlock());
             $page->add_block(new Block("Explanation", "No handler could be found for the page '{$h_pagename}'"));
         }
     }
 }
开发者ID:thelectronicnub,项目名称:shimmie2,代码行数:33,代码来源:main.php


示例17: listFolderFiles

function listFolderFiles($dir)
{
    $ffs = scandir($dir);
    global $main_dir, $content, $localized_strings;
    foreach ($ffs as $ff) {
        if ($ff != '.' && $ff != '..') {
            if (endsWith($ff, '.js')) {
                $file_content = file_get_contents($dir . DS . $ff);
                $matches = getStringsBetween($file_content, "lang(", ")");
                if (count($matches) > 0) {
                    for ($i = 0; $i < count($matches); $i++) {
                        $match = $matches[$i];
                        $match = trim($match);
                        $match = trim($match, "\"\\'");
                        $localized_strings[$match] = $match;
                        // $content .= "\"" . $match . "\" = \"" . $match . "\"\n";
                    }
                }
            }
            if (is_dir($dir . DS . $ff)) {
                listFolderFiles($dir . DS . $ff);
            }
        }
    }
}
开发者ID:antag0n1st,项目名称:jsframework,代码行数:25,代码来源:localization.php


示例18: processPluginsFolder

function processPluginsFolder($folder, $requiredMpsVersion, $pluginsVersion)
{
    $files = scandir($folder);
    foreach ($files as $zipfile) {
        if (pathinfo($zipfile, PATHINFO_EXTENSION) == 'zip') {
            $za = new ZipArchive();
            $za->open($folder . $zipfile);
            for ($i = 0; $i < $za->numFiles; $i++) {
                $stat = $za->statIndex($i);
                $pluginXmlFile = $stat['name'];
                if (endsWith($pluginXmlFile, "META-INF/plugin.xml")) {
                    $stream = $za->getStream($pluginXmlFile);
                    $content = stream_get_contents($stream);
                    $xml = simplexml_load_string($content);
                    if (fixPluginXml($xml, $requiredMpsVersion, $pluginsVersion)) {
                        $za->deleteName($pluginXmlFile);
                        $za->addFromString($pluginXmlFile, $xml->asXML());
                    }
                    printPluginXml($xml, $zipfile, $requiredMpsVersion, $pluginsVersion);
                    break;
                }
            }
        }
    }
}
开发者ID:palpandi111,项目名称:mbeddr.core,代码行数:25,代码来源:repo.php


示例19: validTrim

 /**
  * Verifica se o valor não possui espaços vazios no início ou final
  * @param string $value
  * @return boolean
  */
 protected function validTrim($value)
 {
     if (startsWith($value, ' ') || endsWith($value, ' ')) {
         Factory::log()->warn('Valor possui espaços no início ou no final');
         return false;
     }
     return true;
 }
开发者ID:diego3,项目名称:myframework-core,代码行数:13,代码来源:DatatypeStringBase.php


示例20: koodimonni_mail_from

function koodimonni_mail_from($email)
{
    if (endsWith($email, '@localhost') || empty($email)) {
        $parsed = parse_url(get_site_url());
        $hostname = removeWWW($parsed['host']);
        return "no-reply@{$hostname}";
    }
}
开发者ID:koodimonni,项目名称:mu-plugins,代码行数:8,代码来源:koodimonni-modifications.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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