我是PHP的新手,我面临语法错误.
码:
<?php
// configuration
require("../includes/config.php");
// if form was submitted
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if(empty($_POST['username'])) || empty($_POST['password'] || $_POST['password'] != $_POST['confirmation']){
apologize('You did something wrong!');
}
}
else
{
// else render form
render("register_form.php", ["title" => "Register"]);
}
?>
Run Code Online (Sandbox Code Playgroud)
错误:
解析错误:语法错误,意外'||' (T_BOOLEAN_OR),在第9行的/home/jharvard/vhosts/localhost/html/register.php中期待')'
我是PHP的新手,这个代码有可能存在多个错误.作为参考,道歉只是简单地呈现一个抱歉消息以及其他输入,而渲染只是一个用模板简化渲染过程的功能.
我似乎在一个小的编程任务中遇到了麻烦。(请不要告诉我如何解决整个问题;我只想知道如何将每个字节设置为红色)。
我的代码如下:
#include <stdio.h>
#include <stdlib.h>
#include <cs50.h>
#include "bmp.h"
int main(int argc, char* argv[])
{
// ensure proper usage
//if (argc != 3)
//{
// printf("Usage: copy infile outfile\n");
// return 1;
//}
// remember filenames
//char* infile = argv[1];
//char* outfile = argv[2];
char* infile = GetString();
char* outfile = GetString();
// open input file
FILE* inptr = fopen(infile, "r");
if (inptr == NULL)
{
printf("Could not open %s.\n", infile);
return 2;
}
// open output file
FILE* …Run Code Online (Sandbox Code Playgroud)