Solution to Fatal error that appears when writing php pages

  • 2020-05-05 11:00:44
  • OfStack

Fatal error: Cannot redeclare htmtocode() (previously declared in D:\www_local\mytest\conn.php:7) in D:\www_local\mytest\conn.php on line 10

This error occurs when writing the paging file page.php,

google translates this to mean "fatal error: htmtocode () cannot be redeclared"

Line 10 is

< body >
< ?php

// connect to database

include("conn.php");
// introduce the paging class file

include("page.class.php");

? >

A search on the Internet revealed that the possible reason was that two pages of program files were referenced, which caused conflicts when they were repeatedly loaded in memory
Solution: replace include with include_once()

Related articles: