Pergunta

Eu gostaria que alguém pudesse me dar alguns conselhos sobre como criar o arquivo php, eu sei para o Php Language.as onde escrever. server. pode me dar o direto de como fazer a configuração e tudo. Eu tenho o recurso de pacote NetBeans e servidor wamp. Como devo escrever meu programa PHP com sucesso.plz me ajude a resolver isso.

estou editando a pergunta porque é comentário que é o espaço de palavras dado lá que por que não aceitar

obrigado está funcionando .. você pode me dizer por que esse código não funciona corretamente, meu código PHP (ou conteúdo é esse)

<html>
<head>
    <title>Binary Search</title>
    <style type="text/css">
        h1 {color: blue}
    </style>
</head>
<body>
<h1 align="center">Computer guess number by using binary search</h1>
<form method="GET">
<?
if (empty($flag_num))
{
    $flag_num = -1;
}
if ($flag_num==-1)
{
if (empty($max_num)) $max_num = -1;
if (empty($min_num)) $min_num = -1;
$flag_num = 1;
print <<<Here
<input type="hidden" name="flag_num" value="$flag_num">
<input type="hidden" name="max_num" value="$max_num">
<input type="hidden" name="min_num" value="$min_num">
Input your hidden number: <input type="text" name="hid_num" value="$hid_num"> (1-99)
<br>
<input type="submit" value="Now let's computer guess">
Here;
}
else 
{
if ($max_num==-1 && $min_num==-1)
{
    $max_num = 100;
    $min_num = 0;
    $result_num = $hid_num;
}
else 
{
    if ($comparision == "bigger")
    {
        $min_num = $guess_num;  
    }
    else if ($comparision == "smaller")
    {
        $max_num = $guess_num;  
    }
}
$guess_num = ($max_num + $min_num)/2;
setType($guess_num,"integer");
print "Computer guess <h3> $guess_num </h3>";
if ($guess_num == $result_num)
{
    $flag_num = -1;
}
if ($flag_num == -1)
{
    print <<<Here
<input type="hidden" name="flag_num" value="$flag_num">
<h1> Congratulation, Computer win </h1>
<input type="submit" value="Next>>>" >
Here;
}
else 
{
    print <<<Here
<input type="hidden" name="flag_num" value="$flag_num">
<input type="hidden" name="max_num" value="$max_num">
<input type="hidden" name="min_num" value="$min_num">
<input type="hidden" name="guess_num" value="$guess_num">
<input type="hidden" name="result_num" value="$result_num">
<br>
Your intruction: <input type="radio" name="comparision" value="bigger"> Bigger
                 <input type="radio" name="comparision" value="smaller"> Smaller
<br>
<input type="submit" value="Submit">
Here;
}
}
?>
</form>
</body>
</html>

Não é dar à saída adequadamente conforme necessário

Foi útil?

Solução

wherever wamp is installed go to the folder "www", put the the php file there

then go to localhost:8080/yourfile.php

that's all there is to it

Outras dicas

You could write PHP code in almost anything, and the file will be created as long as you add the .php extension to the new file. I wrote a few simple programs using Notepad and Notepad++ before going onto Eclipse PDT.

To run your file, one out of many ways, you can start up your WAMPserver, browse to http://localhost and drag and drop your file into the browser.

You could also put the .php file inside the www folder (IIRC thats the name of the folder, my memory is a bit hazy) and then browse to http://localhost/name_of_file.php. In either case, if successful, your PHP code should execute on the page.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top