Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 警告:fflush()只需要1个参数,给定0_Php_Mysql - Fatal编程技术网

Php 警告:fflush()只需要1个参数,给定0

Php 警告:fflush()只需要1个参数,给定0,php,mysql,Php,Mysql,您好,我需要install.php中的一些代码帮助,它必须在程序运行之前首先运行,但它会在fflush上出现错误,我不知道该怎么做请帮助 <?php fflush(); authTableCreate(); announceTableCreate(); classTableCreate(); studentTableCreate(); classmembersTableCreate(); at

您好,我需要install.php中的一些代码帮助,它必须在程序运行之前首先运行,但它会在fflush上出现错误,我不知道该怎么做请帮助

    <?php
        fflush();

      authTableCreate();
      announceTableCreate();
      classTableCreate();
      studentTableCreate();
      classmembersTableCreate();
      attendanceTableCreate();
      assignmentTableCreate();
      messageTableCreate();
      supportTableCreate();


      if (!authCheckUserExists('admin')) { // this is their first install probably
          $randpass = 'admin' . mt_rand();
          authAddUser('admin', $randpass, 100, 100);   // create default superuser account
          announceAddAnnouncement('Welcome', 'This is the default start page for IntraSchool.  You should change this to something that describes how the system works within your school.');
    ?>  

    <p>Congratulations!  You have successfully setup <em>IntraSchool</em>.  You may now <a href="login/login.php">login</a> with the username <em>admin</em> and password <em><?=$randpass?></em>.  Please change the password to something you can remember.</p>

    <?php
      } else {
    ?>

    <p>The installation script has reinitialized any deleted tables.</p>

    <?php
      }

      page_footer();
    ?>

恭喜你!您已成功设置校内课程。您现在可以使用用户名admin和密码。请将密码更改为您能记住的密码

安装脚本已重新初始化所有已删除的表

这是一个好的开始

我对您的代码的理解是有限的,因此我不确定您在这里想要完成什么(特别是,看起来您正在执行数据库操作,而
fflush
应该不需要)。也就是说,这里有一点背景:

fflush
将打开的文件刷新到磁盘。您需要为它提供一个文件句柄来刷新

当您写入磁盘上的文件时,操作系统通常会存储一组数据并一次性将其全部写入磁盘,而不是在发送数据时写入每个字节。这主要是出于性能原因。然而,有时,您需要在程序中的特定点写入数据。这就是
fflush
的作用。但是要使
fflush
正常工作,您需要告诉它您正在谈论的文件-这就是文档中提到的文件句柄。

fflush()
需要刷新文件句柄。这很可能是
flush()
的一个输入错误,但是,很明显,它位于文件的开头,根本不起任何作用。你应该删除这行

不过这只是一个警告,所以脚本的其余部分可能已经执行了。如果它是一个只运行一次的安装脚本,那么您可能不需要再次运行它。

也许您想要
flush()
,而不是
fflush()
?如果是这样,那么您使用的代码库已经有10年历史了。您可能需要更新得更晚一些的内容。fflush()将刷新到文件中,您需要将文件资源作为参数传递。