易截截图软件、单文件、免安装、纯绿色、仅160KB

php中有没有向右取字符串的函数

php中有没有向右取字符串的函数?
就像excel里面的right一样。
每天回帖即可获得10分可用分!

substr();

引用
substr();

substr能向右取吗?它是类似以excel的MID函数啊

$str="abcdefg";

$des=substr($str,0,3);//从$str的第一个字符开始,向右去3个字符,也就是"abc"

$des=substr($str,-3,3);//从$str的倒数第三个字符开始,向右去3个字符,也就是"efg"

substr
(PHP 3, PHP 4, PHP 5)

substr -- Return part of a string
Description
string substr ( string string, int start [, int length] )


substr() returns the portion of string specified by the start and length parameters.

If start is non-negative, the returned string will start at the start'th position in string, counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth.

例子 1. Basic substr() usage

<?php
echo substr('abcdef', 1);    // bcdef
echo substr('abcdef', 1, 3);  // bcd
echo substr('abcdef', 0, 4);  // abcd
echo substr('abcdef', 0, 8);  // abcdef
echo substr('abcdef', -1, 1); // f

// Accessing single characters in a string
// can also be achived


相关问答:

php 使用 ADODB 连接Access 的问题

<?php

include("adodb/adodb.inc.php");

$db = &NewADOConnection("access");
$access = realpath("Data.mdb");
$dsn = "Provider=Microsoft.J ......

php 上传视频的问题,在线等

现有一个 avi 格式的视频,
想在一个页面中加一个上传视频的功能,把这个avi的文件上传上去,并可在网页中点击查视频,这怎么实现呀,
自己去找一个普通的上传代码就可以了。

至于查看视频,你指的是在线 ......

php中file_get_contents问题

$a = $_FILES['userfile']['name'] ;

$test = $a;

$p = split('/',$test);

$p[count($p)-1];

$content = file_get_contents("$p");

$con ......

关于php url重写

想把http://www.abc.com/aa/bb/aa.php
重写成http://www.abc.com/aa.php  弄了半天也不知道如何弄~~
这个可以实现么
RewriteRule ^([a-z0-9]+)\/([a-z0-9]+)\/([a-z0-9]+)\.php$ $3.php [L,QSA]

引 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号