更正一下
<?php
/**
* Created by PhpStorm.
* User: juyaobin
* Date: 2018/8/7
* Time: 上午9:55
*/
//4.php
function HouZhuiMing($b='4.php'){
$a = strrchr($b,'.' );
return $a;
}
var_dump( HouZhuiMing('4.txt.html'));
<?php
/**
* Created by PhpStorm.
* User: juyaobin
* Date: 2018/8/7
* Time: 上午9:55
*/
//4.php
function HouZhuiMing($b='4.php'){
$a = strrchr($b,'.' );
return $a;
}
var_dump( HouZhuiMing('4.txt.html'));
2018-08-07
作业
<?php
/**
* Created by PhpStorm.
* User: juyaobin
* Date: 2018/8/7
* Time: 上午9:55
*/
//4.php
function HouZhuiMing($b='4.php'){
$a = strstr($b,'.');
return $a;
}
var_dump( HouZhuiMing('4.txt'));
<?php
/**
* Created by PhpStorm.
* User: juyaobin
* Date: 2018/8/7
* Time: 上午9:55
*/
//4.php
function HouZhuiMing($b='4.php'){
$a = strstr($b,'.');
return $a;
}
var_dump( HouZhuiMing('4.txt'));
2018-08-07
function getExt($filename){
$arr = explode('.',$filename);
$newArr = array_reverse($arr);
echo $newArr[0];
}
getExt($filename='1.txt.html');
课后作业
$arr = explode('.',$filename);
$newArr = array_reverse($arr);
echo $newArr[0];
}
getExt($filename='1.txt.html');
课后作业
2018-06-12
function getExtensionName($fileName){
preg_match('/\.(.+)/i',$fileName,$matches);
return $matches[1];
}
echo getExtensionName('index.txt');
preg_match('/\.(.+)/i',$fileName,$matches);
return $matches[1];
}
echo getExtensionName('index.txt');
2018-05-06
<?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