码迷,mamicode.com
首页 > Web开发 > 详细

php

时间:2016-03-27 15:38:22      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:

move_uploaded_file() 函数将上传的文件移动到新位置。
若成功,则返回 true,否则返回 false

$_FILES[‘myFile‘][‘name‘] 显示客户端文件的原名称。

basename() 函数返回路径中的文件名部分。
<?php
$path = "/testweb/home.php";
//显示带有文件扩展名的文件名
echo basename($path);
//显示不带有文件扩展名的文件名
echo basename($path,".php");
?> 

 

  • public int lastIndexOf(String str): 如果出现字符串参数一次或多次与该对象内的子字符串,则返回最后一个这样的字符串的第一个字符的索引返回。如果不出现作为一个子串,则返回-1。

在String中有两个substring()函数,如下:

一:String.substring(int start)

参数:

    start:要截取位置的索引

返回:

   从start开始到结束的字符串

例如:String str = "hello word!"; 
         System.out.println(str.substring(1));

         System.out.println(str.substring(3));

System.out.println(str.substring(6));

将得到结果为:

         ello word!

         lo word!

         ord!

如果start大于字符串的长度将会抛出越界异常;

二:String.substring(int beginIndex, int endIndex)

参数:

beginIndex 开始位置索引

      endIndex    结束位置索引

返回:

      从beginIndex位置到endIndex位置内的字符串

例如:String str = "hello word!";

         System.out.println(str.substring(1,4));

         System.out.println(str.substring(3,5));

System.out.println(str.substring(0,4));

将得到结果为:

        ello

        lo 

        hello

如果startIndex和endIndex其中有越界的将会抛出越界异常。

 

php

标签:

原文地址:http://www.cnblogs.com/mengwuyan/p/5325562.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!