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

php里如何把字符串转换成字符数组

 解决的办法有好几个:
第一个是:str_split(),这个方法是PHP5加入的。
<?php
$str = "Hello Friend";
$arr1 = str_split($str);
$arr2 = str_split($str, 3);
print_r($arr1);
print_r($arr2);
?>
输出就是:
Array
(
[0] => H
[1] => e
[2] => l
[3] => l
[4] => o
[5] =>
[6] => F
[7] => r
[8] => i
[9] => e
[10] => n
[11] => d
)
Array
(
[0] => Hel
[1] => lo
[2] => Fri
[3] => end
)
第二个是:使用:explode 和 implode来做
第三个是:用substr控制字符串
$tempStr="Hello,World!"
$char_c=substr($tempStr,0,strlen($tempStr));
foreach($char_c as val)
echo(val);


相关文档:

NuSoap介绍 (php调用webservice)(转载)

 http://hi.baidu.com/honfei/blog/item/5e992bfb2704542b4f4aea1a.html
NuSoap介绍 (php调用webservice)
2009年07月04日 星期六 09:41
NuSOAP 是 PHP 环境下的 WEB 服务编程工具,用于创建或调用 WEB 服务。它是一个开源软件,当前版本是 0.7.2 ,支持 SOAP1.1 、 WSDL1.1 ,可以与其他支持 SOAP1.1 和 WSDL1.1 的 ......

多键值cookie(php中cookie存取数组)

cookie默认不能存数组,所以下面的写法是错误的。
 
<?php
$arr = array(1,2,3);
setcookie('a',$arr);
$arr = array(1,2,3);
setcookie('a',$arr);
?>
报错如下:
Warning: setcookie() expects parameter 2 to be string, array given in
但是PHP可以把同名且后面以[]结尾的cookie解析为数组。在 ......

SQLite Tutorial in PHP

 
SQLite Tutorial in PHP
SQLite is an SQL database manager used locally or on a website, and compatible
in particularly with PHP.
Summary
Installing SQLite and creating a database
.
Installing SQLite. Verifying the installation by creating a base.
Creating and using a SQLite tabl ......

php和java关于目录树(列出某一目录下文件结构)

java的写法
/**
*
* @param location
* @param nameList保存结果的!
*/
public void listDict(String location, List<String> nameList) {
File fileList = new File(location);
if (fileList.isDirectory()) {
File[] files = fileList.listFiles();
for (File f : files) {
i ......

MySQL+PHP产生乱码的原因及解决方法

MySQL+PHP产生乱码原因:
  ◆ MySQL数据库默认的编码是utf8,如果这种编码与你的PHP网页不一致,可能就会造成MySQL乱码;
  ◆ MySQL中创建表时会让你选择一种编码,如果这种编码与你的网页编码不一致,也可能造成MySQL乱码;
  ◆ MySQL创建表时添加字段是可以选择编码的,如果这种编码与你的网页编码不一致,也可能造成 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号