Skip to content

Commit 3ed6b77

Browse files
committed
Merge pull request top-think#413 from 772807886/master
修改了IpLocation类的构造函数
2 parents e27461b + f859748 commit 3ed6b77

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ThinkPHP/Library/Org/Net/IpLocation.class.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ class IpLocation
5454
public function __construct($filename = "UTFWry.dat")
5555
{
5656
$this->fp = 0;
57-
if (($this->fp = fopen(dirname(__FILE__) . '/' . $filename, 'rb')) !== false) {
57+
if(!is_file($filename)) {
58+
$filename = dirname(__FILE__) . '/' . $filename;
59+
}
60+
if (($this->fp = fopen($filename, 'rb')) !== false) {
5861
$this->firstip = $this->getlong();
5962
$this->lastip = $this->getlong();
6063
$this->totalip = ($this->lastip - $this->firstip) / 7;

0 commit comments

Comments
 (0)