做网站设计用到的软件,电子商务网站功能模块,网站用什么域名,推广网站排名起因由于项目的数据库需要用客户购买的Oracle数据库#xff0c;所以需要php安装oci扩展。运行环境php : 7.2系统: windows10oracle: 11gR2安装相关环境由于php的oci8扩展还是需要使用到oracle的一些包#xff0c;所以先下载这一些。下载完成后解压缩这个压缩包#xff0c;并…起因由于项目的数据库需要用客户购买的Oracle数据库所以需要php安装oci扩展。运行环境php : 7.2系统: windows10oracle: 11gR2安装相关环境由于php的oci8扩展还是需要使用到oracle的一些包所以先下载这一些。下载完成后解压缩这个压缩包并且将这个包的路径添加到PATH中。下载php的oci8扩展windows可以直接到这个网址上下载相应的dllpecl oci8如果是安装了pecl的话可以直接运行 pecl install oci8下载完成后放到php的ext目录下并且编辑php.ini文件添加extensionphp_oci8.dll这样就完成了php与oracle的配置了。在Laravel中使用Laravel默认支持的数据库不包含oracle可以使用 yajra/laravel-oci8这一个包来让Laravel支持oraclecomposer require yajra/laravel-oci8由于这个包已经支持Laravel的自动加载也就不需要自己手动去注册了extra: {branch-alias: {dev-master: 5.6-dev},laravel: {providers: [Yajra\\Oci8\\Oci8ServiceProvider]}},这样就可以使用php连接到oracle了。一个坑我们在使用migration来管理表格的时候一般情况下会对每一个表都要有注释(为了别人能看得懂。。。)。然而这个包有一个bug就是对于表格的注释缺少了前缀。表格的注释是成员变量而不是方法噢。/*** Run the comment on table statement.* Comment set by $table-comment comment;.** param \Yajra\Oci8\Schema\OracleBlueprint $blueprint*/private function commentTable(OracleBlueprint $blueprint){$table $this-wrapValue($blueprint-getTable());if ($blueprint-comment ! null) {$this-connection-statement(comment on table {$table} is {$blueprint-comment});}}这一段代码在/vendor/yajar/laravel-oci8/src/Oci8/Schema/Comment.php 中第40行。这里少了对表前缀的引用导致我们在migrate的时候生成的sql是缺少了表前缀的所以在这里添加一个表前缀上去解决这个问题/*** Run the comment on table statement.* Comment set by $table-comment comment;.** param \Yajra\Oci8\Schema\OracleBlueprint $blueprint*/private function commentTable(OracleBlueprint $blueprint){$table $this-wrapValue($blueprint-getTable());if ($blueprint-comment ! null) {$this-connection-statement(comment on table {$this-connection-getTablePrefix()}{$table} is {$blueprint-comment});}}本作品采用《CC 协议》转载必须注明作者和本文链接