Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
[cakePHP]$result不显示结果_Php_Cakephp - Fatal编程技术网

[cakePHP]$result不显示结果

[cakePHP]$result不显示结果,php,cakephp,Php,Cakephp,大家好。 我需要你的帮助。我想在上显示$result,但它不显示$result的结果 index.ctp DataController.php 请指出我的代码有什么问题。我发现了问题 我忘了输入回声 index.ctp应为 <h1>Index for Data testing</h1> <p><?php echo $result ?></p> 我真傻,哈哈 <?php App::uses('Sanitize','Utility'

大家好。 我需要你的帮助。我想在上显示$result,但它不显示$result的结果

index.ctp

DataController.php

请指出我的代码有什么问题。

我发现了问题

我忘了输入回声

index.ctp应为

<h1>Index for Data testing</h1>
<p><?php echo $result ?></p>
我真傻,哈哈

<?php
App::uses('Sanitize','Utility');

class DataController extends AppController{


    public function index(){
        $this->modelClass = null;
        if($this->request->data){
            $result = "[result]";
            $result .="<br>text1:".Sanitize::stripAll($this->request->data['text1']);
            $result .="<br>check1:".$this->request->data['check1'];
            $result .="<br>radio1:".$this->request->data['radio1'];
            $result .="<br>select1:".$this->request->data['select1'];

        }else{
            $result = "no data.";
        }
        $this->set("result",$result);
    }

}
<h1>Index for Data testing</h1>
<p><?php echo $result ?></p>