zoukankan      html  css  js  c++  java
  • 需要记一下的

    $a=false; $a=""; $a=0;
    $b=false;
    echo $a==$b?"true":"false";

    单引号和双引号的区别:

    单引号内部的变量不会执行
    双引号会执行


    $name = 'hello';
    echo "the $name";

    会输出 the hello

    而如果是单引号

    $name = 'hello';
    echo 'the $name';

    会输出 the $name

    public function demo() {
    // 		$a=array("Dog","Cat","Horse");
    // 		echo array_pop($a);exit;
    // 		print_r($a);
    		
    		
    		$baseurl = 'http://www.abc.com/a/index.html';
    		$srcurl = '../abc/a.js';
    // 		http://www.abc.com/abc/a.js
    		$srcinfo = parse_url ( $srcurl );
    // 		Array
    // 		(
    // 		    [path] => ../abc/a.js
    // 		)
    		if (isset ( $srcinfo ['scheme'] )) {
    			return $srcurl;
    		}
    		$baseinfo = parse_url ( $baseurl );
    // 		Array
    // 		(
    // 		    [scheme] => http
    // 		    [host] => www.abc.com
    // 		    [path] => /a/index.html
    // 		)
    		$url = $baseinfo ['scheme'] . '://' . $baseinfo ['host'];
    		if (substr ( $srcinfo ['path'], 0, 1 ) == '/') {
    			$path = $srcinfo ['path'];
    		} else {
    			$path = dirname ( $baseinfo ['path'] ) . '/' . $srcinfo ['path'];
    // 			/a/../abc/a.js
    		}
    		$rst = array ();
    		$path_array = explode ( '/', $path );
    // 		Array
    // 		(
    // 		    [0] => 
    // 		    [1] => a
    // 		    [2] => ..
    // 		    [3] => abc
    // 		    [4] => a.js
    // 		)
    		if (! $path_array [0]) {
    			$rst [] = '';
    		}
    		
    		foreach ( $path_array as $key => $dir ) {
    			if ($dir == '..') {
    				if (end ( $rst ) == '..') {
    					$rst [] = '..';
    				} elseif (! array_pop ( $rst )) {
    					$rst [] = '..';
    				}
    			} elseif ($dir && $dir != '.') {
    				$rst [] = $dir;
    			}
    			
    		}
    		if (! end ( $path_array )) {
    			$rst [] = '';
    		}
    		
    		$url .= implode ( '/', $rst );//print_r($url);
    // 		echo str_replace ( '\', '/', $url );
    	}
    

      

  • 相关阅读:
    [转] Java的打包apk, jar、war、ear包
    查看网络端口
    adb删除系统软件
    打开大文件的方法
    转载:Adb远程连接Android系统(通过网络使用ADB(Connect to android with wifi))
    网站后台语言(笔记)
    mysql和mysqli使用笔记
    Data Management Technology(5) -- Recovery
    Data Management Technology(4) -- 关系数据库理论
    Data Management Technology(3) -- SQL
  • 原文地址:https://www.cnblogs.com/happydd/p/3948692.html
Copyright © 2011-2022 走看看