Maison >développement back-end >tutoriel php >PHP 传参数 字符串 语法错误

PHP 传参数 字符串 语法错误

WBOY
WBOYoriginal
2016-06-23 14:26:491181parcourir

php 数据库

我在看别人代码,发现传参数 和 字符串中的 单双 引号比较困难

我把东东贴上来了,实现基本上都去掉了

用了别人的类, 也不知道对不对, 帮忙看看吧,反正总是错, 我把错的地方都贴上来了

调用出错的地方
// 第一个$database = new AAAA([    'database_type' => 'mysql',    'database_name' => 'web_paris_station',    'server' => 'localhost',    'username' => 'root',    'password' => 'root',    'charset' => 'utf8',    'option' => [PDO::ATTR_CASE => PDO::CASE_NATURAL],]);// 第二个$datas = $database->insert("sell", [        "brand" => $_POST['brand'],        "style" => $_POST['style'],        "price" => $_POST['price'],        "condition" => $_POST['condition'],        "description" => $_POST['description'],        'image' => "upload/" . $_FILES["file"]["name"]    ]);// 第三个$datas = $database->select(            "user",            ["*"],            ["where" => "email = ".$_POST['email']]        );




class AAAA{	protected $database_type = 'mysql';	// For MySQL, MSSQL, Sybase	protected $server = 'localhost';		protected $username = 'username';		protected $password = 'password';	// For SQLite	protected $database_file = '';	// Optional	protected $charset = 'utf8';	protected $database_name = '';	protected $option = array();		public function __construct($options)	{			}		public function query($query)	{			}	public function exec($query)	{			}	public function quote($string)	{			}	protected function array_quote($array)	{			}	protected function data_implode($data, $conjunctor, $outer_conjunctor = null)	{			}	public function where_clause($where)	{			}			public function select($table, $columns, $where = null)	{			}			public function insert($table, $data)	{			}		public function update($table, $data, $where = null)	{			}		public function delete($table, $where)	{			}		public function replace($table, $columns, $search = null, $replace = null, $where = null)	{			}	public function get($table, $columns, $where = null)	{			}	public function has($table, $where)	{			}	public function count($table, $where = null)	{			}	public function max($table, $column, $where = null)	{			}	public function min($table, $column, $where = null)	{			}	public function avg($table, $column, $where = null)	{			}	public function sum($table, $column, $where = null)	{	}	public function error()	{			}	public function last_query()	{			}	public function info()	{			}}

回复讨论(解决方案)

将 array() 简写成 [] 是 php5.4 才有的功能

1.升级PHP版本到5.4
2.将所有[] 改成 array()

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn