doujiang1832 2016-10-15 09:54
浏览 67

调用脚本时页面无法正确显示

I'm trying to build my app with a MVC pattern, to do that I followed a book. In my index.php page I have a button, when I click on that button I want to call my formController to display a form, I'm trying to do that first just showing a simple text with <h1> but it doesnt show any text just a blank page.

Index.php

<?php
    //check for errors
    error_reporting(E_ALL);
    ini_set("display errors",1);

    include_once "Models/PageData.php";
    $pageData = new PageData();
    $pageData->title = "OSeuCondómiono - Gere tudo apartir de uma única plataforma";
    $pageData->bootstrap = "<link href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'rel='stylesheet'>";
    $pageData->jquery = "<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js'></script>";
    $pageData->bootstrapScript = "<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js'></script>"; 
    $pageData->googleApiFont = "<link href='https://fonts.googleapis.com/css?family=Merriweather|Open+Sans|Oswald|Roboto'>";
    $pageData->addCss("Css/style.css");
    $pageData->content = include_once "Views/home.php";

    $formButton = isset($_GET['form-nav']);
    if($formButton){
        $pageData->content = include_once "Controllers/loginFormCont.php";
    }
    $page = include_once "Views/layout.php";
    echo $page;
?>

loginFormControler

<?php
    return "<h1>HIIIII</h1>";
?>

that <h1> doesn't display. I don't know why.

  • 写回答

1条回答 默认 最新

  • duanmanpi9358 2016-10-15 10:08
    关注

    Did you try echo instead of return. Return is better to be used inside a function. Yours is used outside a function.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看