多次运行相同的方法 [英] run same method multiple times

查看:71
本文介绍了多次运行相同的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?php

class article{
	
private $row;

public function __construct(){

require_once('connection.php'); 
mysql_select_db($db, $test);	

$query = "SELECT * FROM articles WHERE path = $_SESSION['path']";
$result = mysql_query($query, $test) or die(mysql_error());
$this->row = mysql_fetch_array($result);


}

public function process($field) {

if($field == 'tool'){
echo $this->row['path'];
}
else if($field == 'test'){
echo $this->row['title'];
}
 

}


}

$obj = new article();
$obj->process('tool');
$obj = new article();
$obj1->process('test');

?>





如何在这种情况下运行两次流程方法?它只运行一次,执行停止。



How to run the process method twice in this scenario? It just run once and execution stops.

推荐答案

row ;

public function __construct(){

require_once(' connection .PHP');
mysql_select_db(
row; public function __construct(){ require_once('connection.php'); mysql_select_db(


db,


test);

test);


这篇关于多次运行相同的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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