PHP学习笔记 ThinkPHP

//检测文件是否存在

if(!file_exists(dirname(__FILE__)."/Bo/Admin/Conf/config.php"))
{
    header('Location:install/index.php');
    exit();
}
// 检测PHP环境
if(version_compare(PHP_VERSION,'5.3.0','<'))  die('require PHP > 5.3.0 !');
//生成随机字符
function GetRandomString($length = 10) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, strlen($characters) - 1)];
    }
    return $randomString;
}
if (function_exists("mssql_connect")) {
    echo 'PHP环境支持MSSQL!';
    exit();
} else {
    echo '环境不支持MSSQL数据库!';
    exit();
}
[PHP_PDO_SQLSRV]
extension=php_pdo_sqlsrv_56_ts.dll
[PHP_SQLSRV]
extension=php_sqlsrv_56_ts.dll
mssql.secure_connection = Off
; 连接到数据库时使用NT身份认证
; 重启apache,phpinfo(),搜索sqlsrv
    'DB_TYPE' => 'sqlsrv', // 数据库类型
    'DB_HOST' => '10.10.32.23', // 服务器地址
    'DB_NAME' => 'DEV001', // 数据库名
    'DB_USER' => 'sa', // 账号
    'DB_PWD' => '***', // 密码
//php调用mysql存储过程返回结果集
<?php
  $db = new mysqli('localhost', 'root','', 'mydatabase');

  $result = $db->query('CALL get_employees()');

  while (list($employee_id, $name, $position) = $result->fetch_row()) {
     echo '$employeeid, $name, $position <br />';
  }

?>
        // 加载动态应用公共文件和配置
        load_ext_file(COMMON_PATH);
 '__PUBLIC__'    =>  __ROOT__.'/Public',// 站点公共目录
<?php
$arr01 = array(
//前台或后台其他的配置信息
);
$arr02 = include './config.inc.php';
//组合这二个数组
return array_merge($arr01,$arr02);
?>
原文地址:https://www.cnblogs.com/ilookbo/p/5599727.html