PHP: cannot declare class because the name is already in use

前端 未结 6 954
南方客
南方客 2020-12-29 19:14

I have 5 scripts:

  1. database.php
  2. parent.php
  3. child1.php
  4. child2.php
6条回答
  •  爱一瞬间的悲伤
    2020-12-29 19:23

    You should use require_once and include_once. Inside parent.php use

    include_once 'database.php';
    

    And inside child1.php and child2.php use

    include_once 'parent.php';
    

提交回复
热议问题