ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
ip方法支持检测是否是正确的IP地址。支持IPv4和IPv6。 如果想要单独检测IPv4格式IP请使用Validator::ipv4() 如果想要单独检测IPv6格式IP请使用Validator::ipv6() 格式: ~~~ Validator::ip(值) Validator::ipv4(值) Validator::ipv6(值) ~~~ 用法: ~~~ Validator::ip('127.0.0.1'); // true Validator::ipv4('127.0.0.1'); // true Validator::ipv6('127.0.0.1'); // false ~~~ ~~~ Validator::ip('127.0.0.256'); // false Validator::ipv4('127.0.0.256'); // false Validator::ipv6('127.0.0.256'); // false ~~~ ~~~ Validator::ip('::ffff:192.168.89.9'); // true Validator::ipv4('::ffff:192.168.89.9'); // false Validator::ipv6('::ffff:192.168.89.9'); // true ~~~ ~~~ Validator::ip('0000:0000:0000:0000:0000:0000:c0a8:5909'); // true Validator::ipv4('0000:0000:0000:0000:0000:0000:c0a8:5909'); // false Validator::ipv6('0000:0000:0000:0000:0000:0000:c0a8:5909'); // true ~~~ ~~~ Validator::ip('::'); // true Validator::ipv4('::'); // false Validator::ipv6('::'); // true ~~~