Medoo,简短的ajax语法

时间:2014-04-10 21:36:37

标签: php mysql medoo

我有Medoo框架的问题,所有在localhost(php> 5.4+)上工作正常但在我的服务器上我已经使用了PHP 5.3+,你能帮助我如何将这段代码转换为旧的数组版本并执行代码在PHP 5.3上。平台。

$database = new medoo array(
    // required
    'database_type' => 'mysql',
    'database_name' => 'mytable',
    'server' => 'localhost',
    'username' => 'root',
    'password' => '',

 // optional
    'port' => 3306,
    'charset' => 'utf8',
        'option' => [
        PDO::ATTR_CASE => PDO::CASE_NATURAL
    ]
);


$database->insert("table", [
    "project_name" => "Some text",
    "project_owner" => "Some Text",
    "project_time" => "10/10/2014",
    "project_target" => "- Target one, - Target two, - Target three",
    "project_details" => "This is my project."
]);

2 个答案:

答案 0 :(得分:3)

<?php
require  'medoo.php';

$database = new medoo(array(
    'database_type' => 'mysql',
    'database_name' => 'test',
    'server' => 'localhost',
    'username' => 'testu',
    'password' => 'asdf'


));

$database->insert("table", array(
    "project_name" => "x",
    "project_owner" => "x",
    "project_time" => "x",
    "project_target" => "x",
    "project_details" => "x"
))
?>

答案 1 :(得分:2)

用数组调用替换括号。所有括号都是数组的简短形式。

http://www.php.net/manual/en/language.types.array.php