Notice (8): file_put_contents(): Write of 270 bytes failed with errno=28 No space left on device [CORE/src/Log/Engine/FileLog.php, line 140]

Notice: file_put_contents() [function.file-put-contents]: Write of 1108 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 5131 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 3151 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 5437 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 3151 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): unserialize() [<a href='https://secure.php.net/function.unserialize'>function.unserialize</a>]: Error at offset 20444 of 20469 bytes [APP/Controller/NewsController.php, line 5571]

Notice: file_put_contents() [function.file-put-contents]: Write of 2759 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 6549 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 2791 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (512): long cache was unable to write '7ec6c1e83cddb3da44f80f6b2a9d93bb' to Cake\Cache\Engine\FileEngine cache [CORE/src/Cache/Cache.php, line 275]

Notice: file_put_contents() [function.file-put-contents]: Write of 2585 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Undefined array key "nsort" [APP/Controller/NewsController.php, line 3613]

Notice: file_put_contents() [function.file-put-contents]: Write of 2073 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Trying to access array offset on value of type null [APP/Controller/NewsController.php, line 3613]

Notice: file_put_contents() [function.file-put-contents]: Write of 2097 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Undefined array key "nsort" [APP/Controller/NewsController.php, line 3613]

Notice: file_put_contents() [function.file-put-contents]: Write of 2073 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Trying to access array offset on value of type null [APP/Controller/NewsController.php, line 3613]

Notice: file_put_contents() [function.file-put-contents]: Write of 2097 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 208 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 2790 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (512): long cache was unable to write '4fc3bb14af001a87274cdd97ff99a349' to Cake\Cache\Engine\FileEngine cache [CORE/src/Cache/Cache.php, line 275]

Notice: file_put_contents() [function.file-put-contents]: Write of 2585 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): SplFileObject::fwrite() [<a href='https://secure.php.net/splfileobject.fwrite'>splfileobject.fwrite</a>]: Write of 127 bytes failed with errno=28 No space left on device [CORE/src/Cache/Engine/FileEngine.php, line 141]

Notice: file_put_contents() [function.file-put-contents]: Write of 2790 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (512): long cache was unable to write '7f816cf68a816202c701f0ae1be85256' to Cake\Cache\Engine\FileEngine cache [CORE/src/Cache/Cache.php, line 275]

Notice: file_put_contents() [function.file-put-contents]: Write of 2585 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Notice (8): unserialize() [<a href='https://secure.php.net/function.unserialize'>function.unserialize</a>]: Error at offset 69607 of 69621 bytes [APP/Controller/NewsController.php, line 5571]

Notice: file_put_contents() [function.file-put-contents]: Write of 2489 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
PHP、Asp和MsSQL将IP地址转换为整型数字的方法小结 - 站长搜索
首页 > 资讯列表 > 编程/数据库 >>

PHP、Asp和MsSQL将IP地址转换为整型数字的方法小结

Warning (2): Undefined array key "nsort" [ROOT/plugins/Kuhuang/templates/Websites/view.php, line 430]
Notice: file_put_contents() [function.file-put-contents]: Write of 2421 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Trying to access array offset on value of type null [ROOT/plugins/Kuhuang/templates/Websites/view.php, line 430]

Notice: file_put_contents() [function.file-put-contents]: Write of 2445 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
">
Warning (2): Undefined array key "nsort" [ROOT/plugins/Kuhuang/templates/Websites/view.php, line 430]

Notice: file_put_contents() [function.file-put-contents]: Write of 2421 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
Warning (2): Trying to access array offset on value of type null [ROOT/plugins/Kuhuang/templates/Websites/view.php, line 430]

Notice: file_put_contents() [function.file-put-contents]: Write of 2445 bytes failed with errno=28 No space left on device in /www/wwwroot/www.adminso.com/vendor/cakephp/cakephp/src/Log/Engine/FileLog.php on line 140
2014-12-02 09:52:26 转载来源: 网络整理/侵权必删

本文为大家整理了三种PHP、Asp和MsSQL将IP地址转换为整型数字的方法小结,感兴趣的同学参考下。 首先我们要先了解一下IP地址转换为整型(严格来说应该说是长整型)的原理~ 【转换原理】:假设IP为:w.x.y.z,则IP地址转为整型数字的计算公式为:intIP = 256*256*256*w + 256*256*x + 256*y + z 【PHP的互转】:PHP的转换方式比较简单,它内置了两个函数 int ip2long ( string $ip_address )和 string long2ip ( string $proper_address ) 可以直接调用使用~ 【Asp的互转】:自定义函数如下, '.-----------------------------------------------------------. '|  describtion: 将IP转换为int型数字           &n

本文为大家整理了三种PHPAspMsSQLIP地址转换整型数字方法小结,感兴趣的同学参考下。

首先我们要先了解一下IP地址转换为整型(严格来说应该说是长整型)的原理~

【转换原理】:假设IP为:w.x.y.z,则IP地址转为整型数字的计算公式为:intIP = 256*256*256*w + 256*256*x + 256*y + z

【PHP的互转】:PHP的转换方式比较简单,它内置了两个函数
int ip2long ( string $ip_address )和 string long2ip ( string $proper_address )
可以直接调用使用~

【Asp的互转】:自定义函数如下,
'.-----------------------------------------------------------.
'|  describtion: 将IP转换为int型数字                           |
'~-----------------------------------------------------------~
Function IP2Num(ByVal strIP)
    Dim nIP
    Dim nIndex
    Dim arrIP
    arrIP = Split(strIP, ".", 4)
    For nIndex = 0 To 3
        If Not nIndex = 3 Then
            arrIP(nIndex) = arrIP(nIndex) * (256 ^ (3 - nIndex))
        End If
        nIP = nIP + arrIP(nIndex)
    Next
    IP2Num = nIP
End Function
'.-----------------------------------------------------------.
'|  describtion: 将int型数字转换为IP                           |
'~-----------------------------------------------------------~
Function Num2IP(ByVal nIP)
    Dim strIP
    Dim nTemp
    Dim nIndex
    For nIndex = 3 To 0 Step -1
     nTemp = Int(nIP / (256 ^ nIndex))
     strIP = strIP & nTemp & "."
     nIP = nIP - (nTemp * (256 ^ nIndex))
    Next
    strIP = Left(strIP, Len(strIP) - 1)
    Num2IP = strIP
End Function

【MsSQL的互转】:自定义函数如下,
/***************************************************************
 * 将IP转换为int型数字                         |
 **************************************************************/
CREATE FUNCTION [dbo].[ipToInt](  
 @strIp varchar(15)  
)RETURNS bigint  
AS  
BEGIN  
 declare @nIp bigint  
 set @nIp = 0   
 select
  @nIp = @nIp + LEFT( @strIp, charindex('.',@strIp+'.')-1)*Id 
 from(  
  select Id = cast(1*256*256*256 as bigint)  
  union all select 1*256*256  
  union all select 1*256  
  union all select 1
 ) as T
 return (@nIp)
END 

/***************************************************************
 * 将int型数字转换为IP                         |
 **************************************************************/
CREATE FUNCTION [dbo].[intToIP](
 @nIp bigint  
)RETURNS varchar(15)  
As  
BEGIN  
 declare @strIp varchar(15)  
 set @strIp = ''  
 select
  @strIp = @strIp +'.'+ cast(@nIp/ID as varchar), @nIp = @nIp%ID
 from(  
  select ID = cast(1*256*256*256 as bigint)  
  union all select 1*256*256  
  union all select 1*256  
  union all select 1
 ) as T  
 return(stuff(@strIp,1,1,''))  
END 

【MySQL的互转】:相对于MsSQL来说MySQL的转换方式比较简单,它和PHP一样也内置了两个函数
IP转为整型: select INET_ATON (IP地址) 和 整型转为IP: select INET_NTOA ( IP的整型数值 )
可以直接调用使用~


标签: PHP Asp MsSQL IP 地址 转换 整型 数字 方法


声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!

站长搜索

http://www.adminso.com

Copyright @ 2007~2024 All Rights Reserved.

Powered By 站长搜索

打开手机扫描上面的二维码打开手机版


使用手机软件扫描微信二维码

关注我们可获取更多热点资讯

站长搜索目录系统技术支持