搜索

首页  >  问答  >  正文

mysql - 如何使用php调用sql server的存储过程?

在yii框架中用php调用sql server的存储过程,怎么操作。比如一个存储过程的方法名字为pc_sms_send,其中带有参数,如a,b,c,d.调用成功返回1,失败返回0.求示例代码

迷茫迷茫2896 天前521

全部回复(1)我来回复

  • PHPz

    PHPz2017-04-10 15:31:49

    1

    2

    3

    4

    5

    6

    7

    8

    9

    <code><?php

    /* Call a stored procedure with an INOUT parameter */

    $colour = 'red';

    $sth = $dbh->prepare('CALL puree_fruit(?)');

    $sth->bindParam(1, $colour, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 12);

    $sth->execute();

    print("After pureeing fruit, the colour is: $colour");

    ?>

    </code>

    PHPNET

    回复
    0
  • 取消回复