<?php
function getExt($filename) {
$ext = substr(strstr($filename, '.'), 1);
return $ext;
}
echo getExt('adfhadkghaf.ppp');
function getExt($filename) {
$ext = substr(strstr($filename, '.'), 1);
return $ext;
}
echo getExt('adfhadkghaf.ppp');
2018-05-01
function str($t){
$strNum=strripos($t, '.');
return substr($t, $strNum);
}
echo str('2.1.1.txt');
$strNum=strripos($t, '.');
return substr($t, $strNum);
}
echo str('2.1.1.txt');
2018-04-25
//根据传入的$n随机取数字或字母,$n=1取数字,$n=2取大写字母,$n=3取小写字母
function gChar($n){
$ch = '';
switch($n){
case 1:
$ch = chr(rand(ord('0'), ord('9')));
break;
case 2:
$ch = chr(rand(ord('A'), ord('Z')));
break;
case 3:
$ch = chr(rand(ord('a'), ord('z')));
break;
}
return $ch;
}
function gChar($n){
$ch = '';
switch($n){
case 1:
$ch = chr(rand(ord('0'), ord('9')));
break;
case 2:
$ch = chr(rand(ord('A'), ord('Z')));
break;
case 3:
$ch = chr(rand(ord('a'), ord('z')));
break;
}
return $ch;
}
2018-04-20
isset($a); //变量是否存在
empty($a); //判断变量是否为空值
is_numeric($a); //判断变量是否为数值
unset($a); //销毁变量
empty($a); //判断变量是否为空值
is_numeric($a); //判断变量是否为数值
unset($a); //销毁变量
2018-04-20
include/include_once当包含文件不存在时,只抛出警告,后面程序继续执行;
require/require_once当包含文件不存在时,会导致致命错误,程序退出;
include/require如果重复包含文件,可能会出现函数重复定义的错误;
require/require_once当包含文件不存在时,会导致致命错误,程序退出;
include/require如果重复包含文件,可能会出现函数重复定义的错误;
2018-04-20
call_user_func($fn, $param);
call_user_fun_array($fn, $paramArr);
call_user_fun_array($fn, $paramArr);
2018-04-19
function fn($filename){
return explode(',',$filename)[1];
}
fn('youAreFeiChangNiuBi.php'); //php
return explode(',',$filename)[1];
}
fn('youAreFeiChangNiuBi.php'); //php
2018-04-19
function extend_end($filename)
{
echo substr($filename,strripos($filename, ".")+1);
}
extend_end('dsadas.html');
{
echo substr($filename,strripos($filename, ".")+1);
}
extend_end('dsadas.html');
2018-04-02