Home >Backend Development >PHP Tutorial >很简单的有关问题,就是不知道为什么

很简单的有关问题,就是不知道为什么

WBOY
WBOYOriginal
2016-06-13 10:09:24979browse

很简单的问题,就是不知道为什么?
index.php

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->            <title>计算</title>                <p></p><center>周长面积计算</center>        <p></p><center>            <a href="index.php?id=rect">正方形</a> ||             <a href="index.php?id=triangle">三角形</a> ||             <a href="index.php?id=circle">圆形</a>                    </center>        <hr>        <?php function __autoload($className){                include $className.'.class.php';            }            echo new form;            echo $_REQUEST['id'];        ?>    

form.class.php
PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php class form{        private $shape;        function __construct(){            $this->shape=isset($_REQUEST["id"]) ? $_REQUEST["id"]:"rect";        }        function __toString(){            $form='
'; switch($this->shape){ case "rect": $form.=$this->getRect(); break; case "Triangle": $form.=$this->getTriangle(); break; case "circle": $form.=$this->getCircle(); break; default: echo '没有这个图形'; } $form.=''; $form.='
'; return $form; } private function getRect(){ $input='

请输入矩形的宽高

'; $input.='

宽度:

'; $input.='

高度:

'; return $input; } private function getTriangle(){ $input='

请输入三角形的三边

'; $input.='

第一边:

'; $input.='

第二边:

'; $input.='

第三边:

'; return $input; } private function getCircle(){ $input='

请输入圆的半径

'; $input.='

半径:

'; return $input; } }?>

--------------------
点三角形的时候,为什么会输出‘没有这个图形’,那里写错了?

------解决方案--------------------
id=triangle

case "Triangle":

=====================
understand??
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn