2017-04-10 17:00
浏览 91

PHP - 不推荐使用mysql_prep [重复]

This question already has an answer here:

I'm working on a login form and am using some code from a tutorial. Now I don't remember what the mysql_prep was for and whether it's deprecated, since it's not mysqli... I couldn't really make sense of what I googled.

Is it ok to use this or should I use something else or not use it all together?

It looks like this (variables used to update SQL table):

$username = mysql_prep($_POST["username"]);
$password = mysql_prep($_POST["password"]);
$hashed_password = password_hash($_POST["password"], PASSWORD_DEFAULT);


图片转代码服务由CSDN问答提供 功能建议

此问题已经存在 这里有一个答案:

  • 为什么我不能在PHP中使用mysql_ *函数? 15个答案\ r

    我正在使用登录表单并使用一些 教程中的代码。 现在我不记得mysql_prep的用途以及它是否已被弃用,因为它不是mysqli ...我无法理解我用Google搜索的内容。 < p>可以使用它还是我应该使用别的东西或者不能一起使用它?

    它看起来像这样(用于更新SQL表的变量): \ n

      $ username = mysql_prep($ _ POST [“username  “]); 
     $ password = mysql_prep($ _ POST [”password“]); 
     $ hashed_pa​​ssword = password_hash($ _ POST [”password“],PASSWORD_DEFAULT);    
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douhuiyan2772 2017-04-10 17:06

    mysql_prep must be some user defined function. It does not exist in the php docs.

    Look inside this function in your own code and if it has any references to mysql_ functions then consider it deprecated. All mysql_ functions are deprecated as of PHP 5.5 and are removed in PHP 7.

    Use mysqli_ functions or PDO instead.

    解决 无用
    打赏 举报

相关推荐 更多相似问题