尝试使用php构建一个站点 [英] Trying to build a site using php

查看:76
本文介绍了尝试使用php构建一个站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用php爆炸文本文件。首先,我使用文件获取整个文本文件,然后使用explode逐行分解,但是当我运行代码时,我在列表行中得到以下通知:



注意:未定义的偏移量:6英寸



但是,代码给了我想要的结果但是我也得到了一堆通知。请任何人都可以帮助我out



 foreach(文件(  singles.txt as  $ singlesFile)
{
list($ name,$ gender,$ age) ,$ personality,$ os,$ min,$ max)= explode( ,$ singlesFile );
if($ name == $ userName)
{
$ persongender = $性别;
$ personage = $ age ;
$ personpersonality = $ personality ;
$ personos = $ os ;
$ personmin = $ min ;
$ personmax = $ max ;
}

解决方案

singlesFile)
{
list(


名,

性别,

Im trying to explode a text file using php. First, I used file to get the entire text file, and then exploded line by line using explode, but when I run the code I get the follow notice in the list line:

Notice: Undefined offset: 6 in

However, the code gives me the result I want but I also get a bunch of notices .Please can anyone help me out

foreach(file("singles.txt") as $singlesFile)
{
list($name,$gender,$age,$personality,$os,$min,$max)=explode(",",$singlesFile);
if($name==$userName)
{
$persongender = $gender;
$personage = $age;
$personpersonality = $personality;
$personos = $os;
$personmin = $min;
$personmax = $max;
}

解决方案

singlesFile) { list(


name,


gender,


这篇关于尝试使用php构建一个站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆