我正在用 Java 编写一个函数来逐行读取 PHP。我注意到有些行被跳过了。
Java中的函数:
public String ReadContentRegex(String path, String Regex) throws
FileNotFoundException, IOException
{
final StringBuilder contents = new StringBuilder();
BufferedReader br = new BufferedReader(
new InputStreamReader(new FileInputStream(path)));
try {
String line;
while ((line = br.readLine()) != null) {
System.out.println(br.readLine());
}
} finally {
br.close();
}
return contents.toString();
}
Java 应该使用的 PHP 文件BufferedReader
:
<?php #if (!APP_ACT) exit();
class dbtest extends Codeplexon\core\fwcontroller {
public $name = __CLASS__;
static function destruct()
{
// ili 404
echo("Error function: ".__FUNCTION__);
}
public function db()
{
$model = new Codeplexon\model\fwmodel;
$model->db->load();
#$e = $model->db->count();
$model->db->select();
$model->db->from("db");
$model->db->query();
$a = $model->db->fetch();
#$num_rows = $model->db->numrows();
#$lastquery = $model->db->lastquery();
var_dump($a);
}
//etc....
输出错误:
class dbtest extends Codeplexon\core\fwcontroller {
// ili 404
$model = new Codeplexon\model\fwmodel;
$model->db->select();
$a = $model->db->fetch();
$model = new Codeplexon\model\fwmodel;
$obj = array("val" => substr(md5(time()), 0, 10));
}
{
$model->db->load();
$model->db->where("id", "5");
$model = new Codeplexon\model\fwmodel;
$r = $model->db->querycustom('SELECT * FROM a_mvcdb.db WHERE id = 4');
}
{
.toString()
我认为 return 语句或类名有问题,public String ReadContentRegex(String path, String Regex)
但我不确定出了什么问题。