當前位置: 首頁>>代碼示例>>PHP>>正文


PHP spl_classes函數代碼示例

本文整理匯總了PHP中spl_classes函數的典型用法代碼示例。如果您正苦於以下問題:PHP spl_classes函數的具體用法?PHP spl_classes怎麽用?PHP spl_classes使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了spl_classes函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getClass

/**
 * 獲得spl的所有class
 */
function getClass()
{
    $spl_classes = spl_classes();
    foreach ($spl_classes as $key => $val) {
        echo $key . '=>' . $val . '<br />';
    }
}
開發者ID:ray0916,項目名稱:learn,代碼行數:10,代碼來源:base.php

示例2: testCanMockAllSplClasses

 function testCanMockAllSplClasses()
 {
     if (!function_exists('spl_classes')) {
         return;
     }
     foreach (spl_classes() as $class) {
         $mock_class = "Mock{$class}";
         Mock::generate($class);
         $this->assertIsA(new $mock_class(), $mock_class);
     }
 }
開發者ID:sebs,項目名稱:simpletest,代碼行數:11,代碼來源:interfaces_test.php

示例3: testCanMockAllSplClasses

 public function testCanMockAllSplClasses()
 {
     static $classesToExclude = ['SplHeap'];
     foreach (spl_classes() as $class) {
         // exclude classes
         if (in_array($class, $classesToExclude)) {
             continue;
         }
         $mock_class = "Mock{$class}";
         Mock::generate($class);
         $this->assertIsA(new $mock_class(), $mock_class);
     }
 }
開發者ID:simpletest,項目名稱:simpletest,代碼行數:13,代碼來源:interfaces_test.php

示例4: testCanMockAllSplClasses

 function testCanMockAllSplClasses()
 {
     if (!function_exists('spl_classes')) {
         return;
     }
     foreach (spl_classes() as $class) {
         if ($class == 'SplHeap') {
             continue;
         }
         if (version_compare(PHP_VERSION, '5.1', '<') && $class == 'CachingIterator' || $class == 'CachingRecursiveIterator' || $class == 'FilterIterator' || $class == 'LimitIterator' || $class == 'ParentIterator') {
             // These iterators require an iterator be passed to them during
             // construction in PHP 5.0; there is no way for SimpleTest
             // to supply such an iterator, however, so support for it is
             // disabled.
             continue;
         }
         $mock_class = "Mock{$class}";
         Mock::generate($class);
         $this->assertIsA(new $mock_class(), $mock_class);
     }
 }
開發者ID:ningcaichen,項目名稱:laravel-4.1-quick-start-cn,代碼行數:21,代碼來源:interfaces_test.php

示例5: register

 public static function register()
 {
     $autoloads = spl_autoload_functions();
     $callback = array(__CLASS__, 'loadClass');
     //@codeCoverageIgnoreStart
     if (!in_array($callback, $autoloads)) {
         spl_autoload_register($callback);
     }
     if (is_null(self::$splClasses)) {
         self::$splClasses = array();
         foreach (spl_classes() as $splClass) {
             if (false !== strpos($splClass, 'Exception')) {
                 if (!in_array($splClass, self::$splClasses)) {
                     self::$splClasses[$splClass] = $splClass;
                 }
             }
         }
     }
     if (is_null(self::$template)) {
         self::$template = file_get_contents(__DIR__ . '/resources/exception.tpl', LOCK_EX);
     }
     //@codeCoverageIgnoreEnd
 }
開發者ID:dayax,項目名稱:dayax,代碼行數:23,代碼來源:ExceptionFactory.php

示例6: foreach

<?php

/**
 *
 * Host php file to Chapter6 classes
 *
 */
include_once 'class.directoryiteratorexample.php';
/*----------  Available SPL Objects  ----------*/
foreach (spl_classes() as $key => $value) {
    echo $value, "<br>";
}
/*----------  DirectoryIterator SPL  ----------*/
$run = new DirectoryIteratorExample("/var/www/exercises/public_html/php_exercises/");
$run->getAllDirectoryFiles();
開發者ID:wdarking,項目名稱:php_exercises,代碼行數:15,代碼來源:run.php

示例7: isPHPInternalClass

 /**
  * Get a list of PHP defined classes
  *
  * @param $nameOrObject
  * @return bool
  */
 public static function isPHPInternalClass($nameOrObject)
 {
     return in_array(ltrim((string) static::getClass($nameOrObject), '\\'), spl_classes());
 }
開發者ID:phpthinktank,項目名稱:blast-orm,代碼行數:10,代碼來源:Support.php

示例8: foreach

<?php

foreach (spl_classes() as $name) {
    echo $name . '<br>';
}
開發者ID:ralf000,項目名稱:PHP4,代碼行數:5,代碼來源:01-spl.php

示例9: array_merge

<?php

//-----------------------------------------------------------
// settings
//-----------------------------------------------------------
$base_path = "d:/www/htdocs/zend/";
$source_dir = $base_path . "library/";
$packed_dir = $base_path . "packed/";
$compiled_dir = $base_path;
$compiled_file = $compiled_dir . "zend_framework_min.php";
$ADD_SOURCE_FILE_NAMES = 1;
$pattern_require = "/(require_once[\\s\t]*[\"\\'\\(]+([^\\'\"\\(\\)]+?)[\\'\"\\)]+[\\s\t]*;[\\s\t]*)/ims";
//-----------------------------------------------------------
$GLOBALS['CLASSES'] = [];
$GLOBALS['CLASSES_PATHS'] = [];
$GLOBALS["BUILT_IN_CLASSES"] = array_merge(get_declared_classes(), spl_classes(), get_declared_interfaces());
$GLOBALS["INHERIT_TREE"] = [];
$GLOBALS["INHERIT_CHILDREN"] = [];
$GLOBALS["INHERIT_PARENTS"] = [];
$GLOBALS["INHERIT_TOP"] = [];
$GLOBALS["INHERIT_NONE"] = [];
$GLOBALS["ABSTRACT_CLASSES"] = [];
$GLOBALS["INTERFACES"] = [];
//-----------------------------------------------------------
$time_start = array_sum(explode(" ", microtime()));
//-----------------------------------------------------------
/**
* Put string contents to the file
*/
if (!function_exists("file_put_contents")) {
    function file_put_contents($filename, $data)
開發者ID:yfix,項目名稱:yf,代碼行數:31,代碼來源:pack_zend.php

示例10: var_dump

<?php

/**
 * Created by PhpStorm.
 * User: USER
 * Date: 26/5/2015
 * Time: 10:27
 */
var_dump(spl_classes());
開發者ID:JohnsonCheung,項目名稱:try,代碼行數:9,代碼來源:spl_classes.php

示例11: var_dump

<?php

var_dump(is_array(spl_classes()));
開發者ID:badlamer,項目名稱:hhvm,代碼行數:3,代碼來源:spl_classes.php

示例12: spl_classes

<?php

$classes = spl_classes();
foreach ($classes as $classe) {
    $rc = new ReflectionClass($classe);
    print $classe . PHP_EOL;
    foreach ($rc->getMethods() as $method) {
        print ' ' . $method->getName();
        print '(';
        $paramNames = array();
        $parameters = $method->getParameters();
        if (count($parameters) > 0) {
            foreach ($parameters as $parameter) {
                if ($parameter->isOptional()) {
                    $paramNames[] = '[' . $parameter->getName() . ']';
                } else {
                    $paramNames[] = $parameter->getName();
                }
            }
        }
        print implode(', ', $paramNames);
        print ')';
        print '<br>' . PHP_EOL;
    }
}
開發者ID:jmoliver,項目名稱:php-programando-com-orientacao-a-objeto,代碼行數:25,代碼來源:reclection_docs.php

示例13: print_r

<?php

print_r(spl_classes());
開發者ID:GrUSP,項目名稱:php_best_practices,代碼行數:3,代碼來源:spl_classes.php


注:本文中的spl_classes函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。