zoukankan      html  css  js  c++  java
  • test 2017-1-5

    //    dpm(drupal_get_filename('module','devel'));
    //    sites/all/modules/contrib/dev/devel/devel.module

        //$abc = array('a','b','c');
        //$abc = 'abc';
        //dpm($efg);
        //Notice: Undefined variable: efg in qin_tt_init() (line 176 of D:WWWlocalsitesallmodulescustomdirectory_testqin_tt.module).
        //空白没有其他的报错


    //    $arr1 = array('a','b','c');
    //    $arr2 = array('a'=>'a','b'=>'b','c'=>'c');
    //    $arr3 = array('z'=>'a','x'=>'b','d'=>'c');
    //ksort($arr1);
    //ksort($arr2);
    //ksort($arr3);
    //    dpm($arr1);
    //dpm($arr2);
    //dpm($arr3);
    //    //
    //    ... (Array, 3 elements)
    //
    //    d (String, 1 characters ) c
    //    x (String, 1 characters ) b
    //    z (String, 1 characters ) a


    //    $arr5 = array(6,'z'=>'a','x'=>'b','d'=>'c');
    //    ksort($arr5);
    //    dpm($arr5);
    //
    //        ... (Array, 4 elements)
    //
    //        d (String, 1 characters ) c
    //        x (String, 1 characters ) b
    //        z (String, 1 characters ) a
    //        0 (Integer) 6
        //ksort的字母是abcd->数字比字母大且比较的是键值

    //$arr = array('ABC'=>'abc');
    //$arr1 = array('abc'=>'abc');
    //
    //    dpm($arr == $arr1); //0
    //
    //    $arr3 = array('ABC'=>'abc');
    //    $arr4 = array('ABC'=>'abc');
    //
    //    dpm($arr3 == $arr4);//1
        //还是挺分大小写的key值,value值就更不用说了

    //    $keys=array("a","b","c","d");
    //    $a1=array_fill_keys($keys,"blue");
    //    print_r($a1);
    //    Array ( [a] => blue [b] => blue [c] => blue [d] => blue )

    //    dpm('a b');
    //    a b

    //    $connection_info = Database::getConnectionInfo();
    //    dpm($connection_info);
    //      ... (Array, 1 element)
    //
    //      default (Array, 7 elements)
    //          database (String, 5 characters ) local
    //          username (String, 4 characters ) root
    //          password (String, 4 characters ) root
    //          host (String, 9 characters ) localhost
    //          port (String, 0 characters )
    //          driver (String, 5 characters ) mysql | (Callback) mysql();
    //          prefix (Array, 1 element)

    //    $files = db_query("SELECT * FROM {registry_file}")->fetchAllAssoc('filename', PDO::FETCH_ASSOC);
    //    dpm($files);
    //    //一个以filename为键的数组其中的值包含filename和hash

    //    $contents = 'final class abc';
    //    preg_match_all('/^s*(?:abstract|final)?s*(class|interface|trait)s+([a-zA-Z0-9_]+)/m', $contents, $matches);
    //    dpm($matches);
    //
    //      ... (Array, 3 elements)
    //        0 (Array, 1 element)
    //            0 (String, 15 characters ) final class abc
    //        1 (Array, 1 element)
    //            0 (String, 5 characters ) class
    //        2 (Array, 1 element)
    //            0 (String, 3 characters ) abc


    //    foreach (file_scan_directory('includes', '/.inc$/') as $filename => $file) {
    //      $files["$filename"] = array('module' => '', 'weight' => 0);
    //    }
    //
    //    dpm($files);
    //    // /includes下共69个.inc文件


        //dpm(db_like('abc//d'));//abc//d
        //dpm(db_like('abc"d'));//abc"d
       // dpm(db_like("a'b"));//a'b
       // dpm(db_like("a%b"));//a\%b
        //dpm(db_like("a&b"));//a&b
        //\%_只对这个三个字母有效

    //    $user = Database::getConnection('default', 'default')
    //      ->select('users', 'r', array('target' => 'default'))
    //      ->fields('r')
    //      // Use LIKE here to make the query case-insensitive.
    //      ->condition('r.name', '%'.db_like('ROOT').'%', 'LIKE')
    //    //  ->condition('r.name', db_like('ROOT'), 'LIKE')
    //      ->execute()
    //      ->fetchAll();
    //
    //    dpm($user);
        //确实大小写忽略

      // dpm(db_like(db_like('a_b%cd')));
        //a\\_b\\%c\\d
    //处理了两次

    //    dpm(str_replace("world","Shanghai","Helloxxxx!"));
    //    //Helloxxxx!


      //  require_once DRUPAL_ROOT . '/ABC.php';
    //    include_once DRUPAL_ROOT . '/ABC.php';

    //    Warning: require_once(D:WWWlocal/ABC.php): failed to open stream: No such file or directory in qin_tt_init() (line 294 of D:WWWlocalsitesallmodulescustomdirectory_testqin_tt.module).
    //    Warning: include_once(D:WWWlocal/ABC.php): failed to open stream: No such file or directory in qin_tt_init() (line 295 of D:WWWlocalsitesallmodulescustomdirectory_testqin_tt.module).
    //    Warning: include_once(): Failed opening 'D:WWWlocal/ABC.php' for inclusion (include_path='.;C:phppear') in qin_tt_init() (line 295 of D:WWWlocalsitesallmodulescustomdirectory_testqin_tt.module).

        //require once是必须要 不然就报错
        //include once是有就给 不然也没关系

       // dpm(__FILE__);
        //D:WWWlocalsitesallmodulescustomdirectory_testqin_tt.module
        //dpm($_SERVER['SCRIPT_FILENAME']);
        //D:/WWW/local/index.php
       // dpm($_SERVER['SCRIPT_NAME']);
        ///local/index.php
        //看来只有__FILE__最实在路径最全

       // dpm(dirname(realpath(__FILE__)));
        //D:WWWlocalsitesallmodulescustomdirectory_test

        //dpm('5.1.59' > '5.0.26');
        //1
        //字符串也可以比较大小的


    //    dpm(array_values('abc'));
    //    //Warning: array_values() expects parameter 1 to be array, string given in qin_tt_init() (line 320 of D:WWWlocalsitesallmodulescustomdirectory_testqin_tt.module).
    //
    //    foreach(array_values('abc') as $abc){
    //      dpm($abc);
    //    }
        //Warning: Invalid argument supplied for foreach() in qin_tt_init() (line 323 of D:WWWlocalsitesallmodulescustomdirectory_testqin_tt.module).
    //同样会报错

    //    foreach(array('a'=>'b','c'=>'d') as $key => $data){
    //      dpm($data);
    //    }


        //require_once DRUPAL_ROOT . '/includes/database/database.inc';

    //    $str = 'SELECT n.nid, n.title, n.created FROM {node} n WHERE n.uid = :uid ORDER BY n.created DESC';
    //
    //    $option = array(array(':uid' => 123));
    //
    //    $dsn = 'mysql:host=localhost;port=3306';
    //    $user= 'root';
    //    $p= 'root';
    //
    //    $op = array('host'=>'localhost','username'=>'root','password'=>'root');
    //
    //    //$conn = new DatabaseConnection_mysql($op);//
    //
    //
    //
    //  //  $conn = new DatabaseConnection($dsn,$user,$p);
    //
    //   // DatabaseConnection::expandArguments($str,$option);
    //
    //    $s = 'SELECT 1 FROM {blocked_ips} WHERE ip = :ip';
    //    $o =  array(':ip'=>'127.0.0.1');
    //    $res = expandArguments($s,$o);
    //    dpm($s);
    //    dpm($res);

    //    foreach (array_filter(array(':ip'=>array(0=>'127.0.0.1')), 'is_array') as $key => $data) {
    //      dpm('aaaaaaaaaaa');
    //    }

    //    dpm(array_filter(array(2,3,4,5),'test_odd'));
    //
    //        ... (Array, 2 elements)
    //            2 (Integer) 4
    //            3 (Integer) 5

    //    dpm(array_filter(array(1,2,3,4,0,5,0)));
    //
    //        ... (Array, 5 elements)
    //
    //            0 (Integer) 1
    //            1 (Integer) 2
    //            2 (Integer) 3
    //            3 (Integer) 4
    //            5 (Integer) 5





    //    $abc = 'qinqiu';
    //    dpm(is_string($abc));


    //    dpm(key(array(1,2)));
    //    //0

    //    $clone = clone((object)array('a'=>1,'b'=>2));
    //    dpm($clone);
    //      ... (Object) stdClass
    //        a (Integer) 1
    //        b (Integer) 2


    //   $users =  db_select('users','u')
    //      ->fields('u')
    //    // ->condition('uid',1)
    //      ->addExpression('count(*)','count')
    //      ->execute();

    //    $q = db_select('users', 'u')
    //    ->fields('u');
    ////      ->condition('QueueID', $task['ID'])
    ////      ->condition('IsDone', 0);
    //    $q->addExpression('count(*)','count');
    //    //addexpression基本就是新增了一个field
    //    $count = $q->execute()->fetchAssoc();
    //    dpm($count);
    //    //现在得出的结论是一个数组有18个元素
    //    //没有addexpression的话就是17个元素

    //    while($user = $users->fetch()){
    //      dpm($user);
    //    }

        //从fetch函数本来来说一次只能提取一个结果集currentrow
        //currentrow是怎么来的呢是reset($this->data)

      //  dpm($users);

    //    $arr = array(1,2,3,4);
    //    dpm(reset($arr));
    //    //1

    //    $arr = array(1,2,3,4);
    //    dpm(key($arr));
    //    //0


    //    $res = db_query('select * from users')->fetchAll(PDO::FETCH_ASSOC);
    //    dpm($res);
    //
    //    $dbms='mysql';
    //    $dbName='local';
    //    $user='root';
    //    $pwd='root';
    //    $host='localhost';
    //    $dsn="$dbms:host=$host;dbname=$dbName";
    //    try{
    //      $pdo=new PDO($dsn,$user,$pwd);
    //      $query = 'select * from users';
    //      $statement = $pdo->prepare($query);
    //
    //      $data = $statement->fetchAll(PDO::FETCH_ASSOC);
    //      dpm($data);
    //
    //    }catch(Exception $e){
    //      echo $e->getMessage().'<br>';
    //    }


    //    define('ABC_QINQIU','abc_abc');
    //    dpm(is_string(ABC_QINQIU));
    //    //1

    //    define('ABC_QINQIU',123);
    //    dpm(is_int(ABC_QINQIU));
    //    //1

        //$i = 1;
        //dpm('abc_'. $i++);
        //abc_1
        //dpm($i);
        //2

  • 相关阅读:
    js中split字符串分割
    获取日期,实时显示当前时间,时间相减
    5.5.4 函数内部属性
    单选按钮radio和下拉选择select,ajax返回数据回显对应值
    如何在HTML不同的页面中,共用头部与尾部?
    android-Activity(四大组件之一)
    android-ImageView及其子类
    android-ActionBar
    android- 菜单
    android-Fragment
  • 原文地址:https://www.cnblogs.com/qinqiu/p/6251920.html
Copyright © 2011-2022 走看看