小编Ami*_*ury的帖子

Cakephp错误:发生了内部错误

我在cakephp中有一些代码会产生错误.

这是PHP控制器:

$this->loadModel( 'Vote' ); //Newly added by amit start
$vote=$this->Vote->getVote($id,$uid);
$this->set('vote',$vote);
$voteCount = count($vote);
$this->set('voteCount',$voteCount);

$voteShow = $this->Vote->find('all', array(
    'fields' => array('SUM(Vote.score)   AS score','count(id) as countId'),
     'conditions'=>array('Vote.type_id'=>$id),
));
$this->set('voteShow',$voteShow);
Run Code Online (Sandbox Code Playgroud)

模型:

public function getVote($id,$uid) {
    if (empty($conditions))
        $conditions = array('Vote.type' => 'blog',
                            'Vote.type_id' => $id,
                            'Vote.user_id' => $uid);

    $users = $this->find('all', array('conditions' => $conditions,
        'order' => 'Vote.id desc'
    ));
    return $users;
}
Run Code Online (Sandbox Code Playgroud)

该代码产生此错误:

Error : An internal error has occurred
Run Code Online (Sandbox Code Playgroud)

这个错误是什么意思?

cakephp internal-server-error

7
推荐指数
1
解决办法
3万
查看次数

如何通过在不同的时间调用相同的方法在文本文件中写入mutilple行?

我想出了一个问题.

这是我的方法如下:

public void someMethod()
{
    StringBuilder newFile = new StringBuilder();
    String edited = "My String Line";
    newFile.append(edited);
    newFile.append("\n");
    FileWriter fstreamWrite = new FileWriter("transaction.txt");
    BufferedWriter out = new BufferedWriter(fstreamWrite);
    out.write(newFile.toString());
    out.close();
}
Run Code Online (Sandbox Code Playgroud)

当我在我的主类中多次调用此方法时,这段代码创建了一个带有"My String Line"行的transaction.txt.但是当我多次调用这个方法来编写"我的字符串行"时,它只是覆盖了行而没有给我输出像.

我的弦线

我的弦线

我的弦线

当我打电话给方法3次.

有没有想过如何通过多次调用相同的方法多次写同一行?

java

1
推荐指数
1
解决办法
548
查看次数

标签 统计

cakephp ×1

internal-server-error ×1

java ×1