dongzhi4470 2012-10-12 17:06
浏览 114
已采纳

类中的PHP调用类返回错误:500 [关闭]

I'm having a hard time new a class in another class. This is an example of the setup:

index.php

<?php
   include("functions/userFunctions.php");

   $user = new UserFunctions ();
   $user->validate();
?>

UserFunctions.php

<?php
   include("../db/userDB.php");

   class UserFunctions extends UserDB
   {
       public function GetHello(){
          $this->DBHello();
       }
   }
?>

UserDB.php

<?php
   class UserDB
   {
       public function DBHello(){
          return "Hello"
       }
   }
?>

Chrome returns: HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

How can this not work?

  • 写回答

1条回答 默认 最新

  • duanhe4267 2012-10-12 17:07
    关注

    Add this to the top of your code

    error_reporting(E_ALL);
    ini_set("display_errors","On");
    

    The right PHP errors would be displayed or swtich it on in your PHP.ini settings

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教