“最經(jīng)常用作回調(diào)函數(shù)(callback)參數(shù)的值 ”這句話,老師講的可不明白呀?;锇閭冊僮x一下題意。老師的例子中是把匿名函數(shù)作為回調(diào)函數(shù)來用的。而不是回調(diào)函數(shù)參數(shù)的值。有沒有伙伴可以貢獻(xiàn)一下正解。
2018-01-29
case 3:
for ($i=1;$i<=$length;$i++){
if($i==rand(1,$length)||$i%2==0){
echo chr(rand(97,122)).'-';
}else
echo rand(0,9).'-';
}
break;
}
}
for ($i=1;$i<=$length;$i++){
if($i==rand(1,$length)||$i%2==0){
echo chr(rand(97,122)).'-';
}else
echo rand(0,9).'-';
}
break;
}
}
2018-01-28
function randTest($type,$length=4){
switch ($type){
case 1:
for($i=1;$i<=$length;$i++){
echo rand(0,9).'-';
}break;
case 2:
for($i=1;$i<=$length;$i++){
echo chr(rand(97,122)).'-';
}break;
switch ($type){
case 1:
for($i=1;$i<=$length;$i++){
echo rand(0,9).'-';
}break;
case 2:
for($i=1;$i<=$length;$i++){
echo chr(rand(97,122)).'-';
}break;
2018-01-28
function createFile($filename){
$file = $filename;
$a = substr(strrchr($file, '.'), 1);
return $a;
}
echo createFile('1.html');
$file = $filename;
$a = substr(strrchr($file, '.'), 1);
return $a;
}
echo createFile('1.html');
2018-01-25
function get_extension($file)
{
return pathinfo($file, PATHINFO_EXTENSION);//返回文件擴(kuò)展名函數(shù)
}
{
return pathinfo($file, PATHINFO_EXTENSION);//返回文件擴(kuò)展名函數(shù)
}
2018-01-17
// 查找文件名,輸出后綴名
function extend_end($filename){
echo substr($filename, strripos($filename, '.'));
}
extend_end('hell000o .world.html');
function extend_end($filename){
echo substr($filename, strripos($filename, '.'));
}
extend_end('hell000o .world.html');
2017-12-23
任務(wù):
function getFileExt(string $path) :string {
return pathinfo($path)['extension'];
}
function getFileExt(string $path) :string {
return pathinfo($path)['extension'];
}
2017-12-22
小任務(wù):
<?php
header('content-type:text/html;charset=utf-8');
if(!function_exists('get_extension')){
function get_extension($file)
{
return pathinfo($file, PATHINFO_EXTENSION);
}
}
echo get_extension('1234234.php.txt');
?>
<?php
header('content-type:text/html;charset=utf-8');
if(!function_exists('get_extension')){
function get_extension($file)
{
return pathinfo($file, PATHINFO_EXTENSION);
}
}
echo get_extension('1234234.php.txt');
?>
2017-12-20
小任務(wù):
<?php
header('content-type:text/html;charset=utf-8');
if(!function_exists('get_extension')){
function get_extension($file)
{
$info = pathinfo($file);
return $info['extension'];
}
}
echo get_extension('1234234.php.txt');
?>
<?php
header('content-type:text/html;charset=utf-8');
if(!function_exists('get_extension')){
function get_extension($file)
{
$info = pathinfo($file);
return $info['extension'];
}
}
echo get_extension('1234234.php.txt');
?>
2017-12-20
小任務(wù):
<?php
header('content-type:text/html;charset=utf-8');
if(!function_exists('get_extension')){
function get_extension($file)
{
return end(explode('.', $file));
}
}
echo get_extension('1234234.php.txt');
?>
<?php
header('content-type:text/html;charset=utf-8');
if(!function_exists('get_extension')){
function get_extension($file)
{
return end(explode('.', $file));
}
}
echo get_extension('1234234.php.txt');
?>
2017-12-20
小任務(wù):
<?php
header('content-type:text/html;charset=utf-8');
if(!function_exists('get_extension')){
function get_extension($file)
{
return substr($file, strrpos($file, '.')+1);
}
}
echo get_extension('1.php.html');
?>
<?php
header('content-type:text/html;charset=utf-8');
if(!function_exists('get_extension')){
function get_extension($file)
{
return substr($file, strrpos($file, '.')+1);
}
}
echo get_extension('1.php.html');
?>
2017-12-20