İnternet Programlama Dersi – 1 (Güz-2017) Hafta – 10 – 1

<html>
<head>
    <meta charset="UTF-8">
    <title>adasds</title>
</head>
<body>
<?php
/**
 * Created by PhpStorm.
 * User: caglar
 * Date: 30.11.2017
 * Time: 20:11
 */

$dizi=["sayfa1","sayfa2","sayfa3"];
foreach($dizi as $d)
    include $d.".php";
if(isset($_GET["sayfa"]))
{

    if(in_array($_GET["sayfa"],$dizi))
    {
        $degisken=$_GET["sayfa"]; // sayfa1 yaziyorsa
        $p = new $degisken(); // new sayfa1()
        $p->index();
        exit;
    }
}
echo "Sayfa Bulunamadi!";
?>
</body>

</html>
<?php
/**
 * Created by PhpStorm.
 * User: caglar
 * Date: 30.11.2017
 * Time: 20:12
 */

class ortak
{
    public $username;

    public function testEt()
    {
        if ($this->username == "caglar")
            return true;
        return false;

    }


}
<?php
/**
 * Created by PhpStorm.
 * User: caglar
 * Date: 30.11.2017
 * Time: 20:12
 */

class sayfa1
{
    public function index()
    {
        ?>
        <h1>
            internet programlama dersi
        </h1>
        <?php

    }
}
<?php
/**
 * Created by PhpStorm.
 * User: caglar
 * Date: 30.11.2017
 * Time: 20:12
 */

class sayfa2
{
    public function index()
    {
       ?>
            <input type="text">
        <?php
    }


}
<?php
/**
 * Created by PhpStorm.
 * User: caglar
 * Date: 30.11.2017
 * Time: 20:28
 */

class sayfa3
{
    public function index()
    {
        ?>

        <table border="1">
            <tr>
                <td>
                    Deneme
                </td>
                <td>
                    Abc
                </td>
            </tr>
        </table>

        <?php

    }

}

 

Share