Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.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
:session_start():无法发送会话缓存限制器-已在中发送头(输出从C:\xampp\htdocs\rail\index.php:446开始)_Php_Session_Session Variables_Php 5.5 - Fatal编程技术网

:session_start():无法发送会话缓存限制器-已在中发送头(输出从C:\xampp\htdocs\rail\index.php:446开始)

:session_start():无法发送会话缓存限制器-已在中发送头(输出从C:\xampp\htdocs\rail\index.php:446开始),php,session,session-variables,php-5.5,Php,Session,Session Variables,Php 5.5,这是警告。即使它不允许我打开admin.php页面,错误是: 无法发送会话缓存限制器-已在中发送标头(输出从C:\xampp\htdocs\rail\index.php:446开始) 试着使用它可能会对您有所帮助 <?php session_start(); ob_start(); error_reporting(E_ALL); include("db.php"); include("redirect.php"); // the file which is stored redire

这是警告。即使它不允许我打开admin.php页面,错误是:

无法发送会话缓存限制器-已在中发送标头(输出从C:\xampp\htdocs\rail\index.php:446开始)


试着使用它可能会对您有所帮助

 <?php
 session_start();
ob_start();
error_reporting(E_ALL); 
include("db.php");
include("redirect.php"); // the file which is stored redirect()   
 if(isset($_POST['log']))
  {

 $user= $_POST['username'];
 $pass= md5($_POST['password']);

  $sql=mysql_query( "select * from reg where username= '$user' AND password='$pass' ") or die( mysql_error());
  $data=mysql_num_rows($sql);
  if ($data == 1) {
    while($row = mysql_fetch_array($sql)){ 

 $_SESSION['username']=$s1;
 redirect('admin.php');            // HERE YOU NEED TO REPLACE THE FUNCTION
     }
    }
    else {
    echo '<script type="text/javascript">';
      echo 'alert("Password Invalid!")';
     echo '</script>';

    }
   }
   ob_end_flush();
   ?>
感谢Rajat Singhal的
redirect()


在一个螺母壳中。有许多事情可能导致此错误/警告。其中大多数都被缩小为在启动会话之前发送到浏览器的一段输出。因此,记住这一点,检查脚本中的输出。这可以是初始化会话之前的简单空白或文本中的任何内容

显示此警告的另一个常见情况是由文件编码触发。可能有一个名为UTF8-BOM的隐藏字符如果您为您的文件设置了错误的编码,某些编辑器可能无法识别。因此,在这种情况下,解决方案是重新检查文件编码


错误消息很清楚,它指出index.PHP和第446行附近的错误消息大致是导致此警告的原因。因此,请检查我在该行或之前提到的内容

PLZ给出一些解决方案!!!!…急切地等待index.PHP在第446行之前的一两行,错误消息再明显不过了。如果失败,这个问题如下所示ked很多次了。看看这个问题右侧的相关专栏。我已经看到了。但是没有找到任何有用的解决方案。请帮助我离开这里。@Darylgill在我输入之前。那么你知道是什么导致了这个警告吗?它是在服务器上运行还是在本地运行?我看不出提供的代码有什么细微的差别。如果这是复制和粘贴。它很可能会触发错误,因为
确定之前有空白。让我检查一下man@Daryl吉尔,看我的编辑,为什么这对op有好处?没有提供学习曲线,这有点离题,因为基本上没有回答Hey@VishnuRNair你能告诉我这个fu放在哪里吗我的代码中有一个选项..我要替换的是伊托克@daryl gill......不,这个空间也不起作用,兄弟。@komaldeepchahal我在问题的评论中提供了一个指向另一个问题的链接。请检查,答案还提供了一段代码,用于缩小错误位置。@deryl你能通过teamvi来pc吗如果你不介意的话,让我检查一下。
     session_start();
    include("db.php");
    if(isset($_POST['log']))
      {

   $user= $_POST['username'];
    $pass= md5($_POST['password']);

   $sql=mysql_query( "select * from reg where username= '$user' AND password='$pass' ") or die( mysql_error());
   $data=mysql_num_rows($sql);
      if ($data == 1) {
   while($row = mysql_fetch_array($sql)){ 

     $_SESSION['username']=$s1;
   echo '<script>window.location="admin.php"</script>';
         }
        }


      else {
        echo '<script type="text/javascript">';
          echo 'alert("Password Invalid!")';
         echo '</script>';

        }
       }
       ob_end_flush();
       ?>
 <?php
 session_start();
ob_start();
error_reporting(E_ALL); 
include("db.php");
include("redirect.php"); // the file which is stored redirect()   
 if(isset($_POST['log']))
  {

 $user= $_POST['username'];
 $pass= md5($_POST['password']);

  $sql=mysql_query( "select * from reg where username= '$user' AND password='$pass' ") or die( mysql_error());
  $data=mysql_num_rows($sql);
  if ($data == 1) {
    while($row = mysql_fetch_array($sql)){ 

 $_SESSION['username']=$s1;
 redirect('admin.php');            // HERE YOU NEED TO REPLACE THE FUNCTION
     }
    }
    else {
    echo '<script type="text/javascript">';
      echo 'alert("Password Invalid!")';
     echo '</script>';

    }
   }
   ob_end_flush();
   ?>
  function redirect($url) {
     if (!headers_sent()) {    
      header('Location: '.$url);
      exit;
  } else {  
    echo '<script type="text/javascript">';
    echo 'window.location.href="'.$url.'";';
    echo '</script>';
    echo '<noscript>';
    echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
    echo '</noscript>'; exit;
  }
}