php中的foreach循环后如何重置对象指针?

时间:2019-07-20 11:48:51

标签: php loops object pdo foreach

我想遍历对象3次,但是数组methor'reset'在对象上不起作用。

/

我只能重复一次。

1 个答案:

答案 0 :(得分:-1)

这是您应该执行的操作:

class Header extends StatefulWidget {

String buttonTitle;
String title;

Header(String buttonTitle , String title) //the constructor I'm gonna 
call
{
this.buttonTitle = buttonTitle;
this.title = title;
}

@override
HeaderState createState() => HeaderState(buttonTitle , title);
}


class HeaderState extends State<Header> {
String buttonTitle;
String title;

HeaderState(String buttonTitle , String title)
{
this.buttonTitle = buttonTitle;
this.title = title;
}

@override
Widget build(BuildContext context) {
//some code
Text("$title", //the first parameter passed dynamically),

RaisedButton(
child: Text(
"$buttonTitle", //the second parameter
),
}


class FirstScreen extends StatefulWidget {
@override
FirstScreenState createState() => FirstScreenState();
}  


class FirstScreenState extends State<FirstScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
Header("OK", "Page1"),//constructor is called here 
);
}
}

-> fetch()命令获取数据集的下一行。