超简单的php获取ip地址信息的接口范例
通过php获取ip所属地的接口,要是自己弄一个ip库的话,会比较麻烦,而且需要经常更新,所以不现实。网上找了一些接口,发现好多都不能用了,于是自己写了一个,通过抓ip138页面来提取信息。只要它不改版,这个就能永久有效。
响应比较快,小网站用此接口完全没有问题,代码如下:
<?php
header("Content-type:text/html;charset=utf-8");
$ip = checkip(@$_GET['ip']);
if(!$ip)
{
exit( json_encode( array('error'=>1, 'msg'=>'参数ip不正确') ) );
}
$url = 'http://www.ip138.com/ips1388.asp?ip='.$ip.'&action=2';
$ipInfo = file_get_contents($url);
$ipInfo = iconv('gb2312', 'utf-8', $ipInfo);
preg_match('/<li>本站主数据:(.*)<\/li><li>/i', $ipInfo, $info);
if($info[1])
{
exit( json_encode( array('error'=>0, 'pos'=>$info[1]) ) );
}
else
{
exit( json_encode( array('error'=>1, 'msg'=>'解析失败') ) );
}
/**
* 验证ip格式是否正确
*/
function checkip($ip)
{
$ip = substr($ip, 0, 15); //ipv4最多只有这么长
if( !preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $ip) )
{
return false;
}
else
{
return $ip;
}
}
?>
访问形式为:localhost/ip.php?ip=xxx.xxx.xxx.xxx。带一个参数就行了,返回为json格式的数据
操作iframe对于许多的前段来讲觉得是一个不可靠的方式了,其实操作iframe是非常的不错并且兼容性也好,下面我们来看一个经典的关于操作iframe的例子。虽然我们在web开发中使用iframe比较少,但是iframe还是有它值得使用的场景,比如嵌入外部广告等。在使用iframe过程中我们可能会遇到很多问题,例如iframe父子窗口传值,iframe自适应高度,iframe跨域通信等等。
实际应用中,我们常常要在父窗口中直接获取子窗口页面的元素,并对其进行操作。今天我来使用实例给大家介绍如何使用Javascript来进行iframe父子窗口之间相互操作dom对象,开始动手。
HTML
为了更好的讲解和演示,我们准备3个页面,父级页面index.html的html结构如下。另外两个子页面分别为iframeA.html和iframeB.html。我们需要演示通过父页面获取和设置子页面iframeA.html中元素的值,以及演示通过子页面iframeB.html设置子页面iframeA.html相关元素的值以及操作父页面index.html元素。
<div class="opt_btn">
<button onclick="getValiframeA();">父窗口获取iframeA中的值</button>
<button onclick="setValiframeA();">父窗口设置iframeA中的值</button>
<button onclick="setBgiframeA();">父窗口设置iframeA的h1标签背景色</button>
</div>
<div id="result">--操作结果--</div>
<div class="frames">
<iframe id="wIframeA" name="myiframeA" src="iframeA.html" scrolling="no" frameborder="1"></iframe>
<iframe id="wIframeB" name="myiframeB" src="iframeB.html" scrolling="no" frameborder="1"></iframe>
</div>
iframeA.html布置一个h1标题,以及一个输入框和一个p段落,结构如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>helloweba.com</title>
</head>
<body>
<h1 id="title">iframe A</h1>
<input type="text" id="iframeA_ipt" name="iframeA_ipt" value="123">
<p id="hello">helloweba.com欢迎您!</p>
</body>
</html>
iframeB.html同样布置h1标题和段落以及输入框。iframe有两个按钮,调用了javascript,相关代码等下在js部分会描述。
<html>
<head>
<meta charset="utf-8">
<title>helloweba.com</title>
</head>
<body>
<h1>iframe B</h1>
<p id="hello">Helloweb.com</p>
<input type="text" id="iframeB_ipt" name="iframeB_ipt" value="1,2,3,4">
<button onclick="child4parent();">iframeB子窗口操作父窗口</button>
<button onclick="child4child();">iframeB操作子窗口iframeA</button>
</body>
</html>
Javascript
页面html都布置好了,现在我们来看Javascript部分。
首先我们来看index.html父级页面的操作。JS操作iframe里的dom可是使用contentWindow属性,contentWindow属性是指指定的frame或者iframe所在的window对象,在IE中iframe或者frame的contentWindow属性可以省略,但在Firefox中如果要对iframe对象进行编辑则,必须指定contentWindow属性,contentWindow属性支持所有主流浏览器。
我们自定义了函数getIFrameDOM(),传入参数iID即可获取iframe,之后就跟在当前页面获取元素的操作一样了。
function getIFrameDOM(iID){
return document.getElementById(iID).contentWindow.document;
}
index.html的三个按钮操作代码如下:
function getValiframeA(){
var valA = getIFrameDOM("wIframeA").getElementById('iframeA_ipt').value;
document.getElementById("result").innerHTML = "获取了子窗口iframeA中输入框里的值:<span style='color:#f30'>"+valA+"</span>";
}
function setValiframeA(){
getIFrameDOM("wIframeA").getElementById('iframeA_ipt').value = 'Helloweba';
document.getElementById("result").innerHTML = "设置了了子窗口iframeA中输入框里的值:<span style='color:#f30'>Helloweba</span>";
}
function setBgiframeA(){
getIFrameDOM("wIframeA").getElementById('title').style.background = "#ffc";
}
保存后,打开index.html看下效果,是不是操作很简单了。
好,iframeB.html的两个按钮操作调用了js,代码如下:
function child4child(){
var parentDOM=parent.getIFrameDOM("wIframeA");
parentDOM.getElementById('hello').innerHTML="<span style='color:blue;font-size:18px;background:yellow;'>看到输入框里的值变化了吗?</span>";
parentDOM.getElementById('iframeA_ipt').value = document.getElementById("iframeB_ipt").value;
parent.document.getElementById("result").innerHTML="子窗口iframeB操作了子窗口iframeA";
}
function child4parent(){
var iframeB_ipt = document.getElementById("iframeB_ipt").value;
parent.document.getElementById("result").innerHTML="<p style='background:#000;color:#fff;font-size:15px;'>子窗口传来输入框值:<span style='color:#f30'>"+iframeB_ipt+"</span></p>";
}
子页面iframeB.html可以通过使用parent.getIFrameDOM()调用了负页面的自定义函数getIFrameDOM(),从而就可以对平级的子页面iframeA.html进行操作,子页面还可以通过使用parent.document操作父级页面元素。
本文结合实例讲解了Javascript对iframe的基本操作,接下来我们会介绍iframe的应用:自适应高度以及iframe跨域问题,敬请关注。
$cache = new FileCache();
$new_arr = $cache->get('gsmcache');//yourkey是你为每一个要缓存的数据定义的缓存名字
if ($new_arr===false) {
$new_arr="数据库返回的数据";
$cache->set('gsmcache',$new_arr,3600);//缓存3600秒
}
<?php
/**
* 文件缓存类
*
* @copyright blog.itiwin.cn
* @author More
* @package cache
* @version v0.1
*/
class FileCache {
/**
* @var string $cachePath 缓存文件目录
* @access public
*/
public $cachePath = './';
/**
* 构造函数
* @param string $path 缓存文件目录
*/
function __construct($path = NULL) {
if ($path) {
$this->cachePath = $path;
}
}
/**
* 析构函数
*/
function __destruct() {
//nothing
}
/**
* 在cache中设置键为$key的项的值,如果该项不存在,则新建一个项
* @param string $key 键值
* @param mix $var 值
* @param int $expire 到期秒数
* @param int $flag 标志位
* @return bool 如果成功则返回 TRUE,失败则返回 FALSE。
* @access public
*/
public function set($key, $var, $expire = 36000, $flag = 0) {
$value = serialize($var);
$timeout = time() + $expire;
$result = safe_file_put_contents($this->cachePath . urlencode($key) .'.cache',
$timeout . '<<%-==-%>>' . $value);
return $result;
}
/**
* 在cache中获取键为$key的项的值
* @param string $key 键值
* @return string 如果该项不存在,则返回false
* @access public
*/
public function get($key) {
$file = $this->cachePath . urlencode($key) .'.cache';
if (file_exists($file)) {
$content = safe_file_get_contents($file);
if ($content===false) {
return false;
}
$tmp = explode('<<%-==-%>>', $content);
$timeout = $tmp[0];
$value = $tmp[1];
if (time()>$timeout) {
$this->delete($key) ;//删除文件过期的
$result = false;
} else {
$result = unserialize($value);
}
} else {
$result = false;
}
return $result;
}
/**
* 清空cache中所有项
* @return 如果成功则返回 TRUE,失败则返回 FALSE。
* @access public
*/
public function flush() {
$fileList = FileSystem::ls($this->cachePath,array(),'asc',true);
return FileSystem::rm($fileList);
}
/**
* 删除在cache中键为$key的项的值
* @param string $key 键值
* @return 如果成功则返回 TRUE,失败则返回 FALSE。
* @access public
*/
public function delete($key) {
return FileSystem::rm($this->cachePath . $key .'.cache');
}
}
if (!function_exists('safe_file_put_contents')) {
function safe_file_put_contents($filename, $content)
{
$fp = fopen($filename, 'wb');
if ($fp) {
flock($fp, LOCK_EX);
fwrite($fp, $content);
flock($fp, LOCK_UN);
fclose($fp);
return true;
} else {
return false;
}
}
}
if (!function_exists('safe_file_get_contents')) {
function safe_file_get_contents($filename)
{
$fp = fopen($filename, 'rb');
if ($fp) {
flock($fp, LOCK_SH);
clearstatcache();
$filesize = filesize($filename);
if ($filesize > 0) {
$data = fread($fp, $filesize);
}
flock($fp, LOCK_UN);
fclose($fp);
return $data;
} else {
return false;
}
}
}
一:启动文件 \app\code\Inchoo\Stripe\etc\module.xml
<?xml version="1.0"?> <config xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd"> <module name="More_Payment" schema_version="1.0.0.0" active="true"> <sequence> <module name="Magento_Sales"/> <module name="Magento_Payment"/> </sequence> <depends> <module name="Magento_Sales"/> <module name="Magento_Payment"/> </depends> </module> </config>
二:配置文件config.xml \app\code\Inchoo\Stripe\etc\config.xml
<?xml version="1.0"?> <config xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " xsi:noNamespaceSchemaLocation="../../../Magento/Core/etc/config.xsd"> <default> <payment> <more_payment> <active>1</active> <model>More\Payment\Model\Payment</model> <payment_action>authorize_capture</payment_action> <title>Payment</title> <api_key backend_model="Magento\Backend\Model\Config\Backend\Encrypted" /> <cctypes>AE,VI,MC,DI,JCB</cctypes> <allowspecific>1</allowspecific> <min_order_total>0.50</min_order_total> </more_payment> </payment> </default> </config>
三:后台配置文件 app\code\Inchoo\Stripe\etc\adminhtml\system2.xml
<?xml version="1.0"?> <config xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/system_file.xsd"> <system> <section id="payment" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="1" showInStore="1"> <group id="more_payment" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Payment</label> <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Enabled</label> <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> </field> <field id="title" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Title</label> </field> <field id="api_key" translate="label" type="obscure" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Api Key</label> <backend_model>Magento\Backend\Model\Config\Backend\Encrypted</backend_model> </field> <field id="debug" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Debug</label> <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> </field> <field id="cctypes" translate="label" type="multiselect" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Credit Card Types</label> <source_model>More\Payment\Model\Source\Cctype</source_model> </field> <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Sort Order</label> </field> <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Payment from Applicable Countries</label> <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> </field> <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Payment from Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> </field> <field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Minimum Order Total</label> </field> <field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Maximum Order Total</label> <comment>Leave empty to disable limit</comment> </field> </group> </section> </system> </config>
四:model类 因为我们在config.xml配置了model,所以前台点击保存支付方式的时候 触发
<?php namespace More\Payment\Model; class Payment extends \Magento\Payment\Model\Method\Cc { const CODE = 'more_payment'; protected $_code = self::CODE; protected $_isGateway = true; protected $_canCapture = true; protected $_canCapturePartial = true; protected $_canRefund = true; protected $_canRefundInvoicePartial = true; protected $_stripeApi = false; protected $_minAmount = null; protected $_maxAmount = null; protected $_supportedCurrencyCodes = array('USD'); public function __construct( \Magento\Framework\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Logger\AdapterFactory $logAdapterFactory, \Magento\Framework\Logger $logger, \Magento\Framework\Module\ModuleListInterface $moduleList, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Centinel\Model\Service $centinelService, \Stripe\Api $stripe, array $data = array() ) { parent::__construct($eventManager, $paymentData, $scopeConfig, $logAdapterFactory, $logger, $moduleList, $localeDate, $centinelService, $data); $this->_stripeApi = $stripe; // $this->_stripeApi->setApiKey( // $this->getConfigData('api_key') // ); $this->_minAmount = $this->getConfigData('min_order_total'); $this->_maxAmount = $this->getConfigData('max_order_total'); } /** * 支付捕获方法 * * * @param \Magento\Framework\Object $payment * @param float $amount * @return $this * @throws \Magento\Framework\Model\Exception */ public function capture(\Magento\Framework\Object $payment, $amount) { /** @var Magento\Sales\Model\Order $order */ $order = $payment->getOrder(); /** @var Magento\Sales\Model\Order\Address $billing */ $billing = $order->getBillingAddress(); try { $charge = \Stripe_Charge::create(array( 'amount' => $amount * 100, 'currency' => strtolower($order->getBaseCurrencyCode()), 'description' => sprintf('#%s, %s', $order->getIncrementId(), $order->getCustomerEmail()), 'card' => array( 'number' => $payment->getCcNumber(), 'number' => $payment->getCcNumber(), 'exp_month' => sprintf('%02d',$payment->getCcExpMonth()), 'exp_year' => $payment->getCcExpYear(), 'cvc' => $payment->getCcCid(), 'name' => $billing->getName(), 'address_line1' => $billing->getStreet(1), 'address_line2' => $billing->getStreet(2), 'address_zip' => $billing->getPostcode(), 'address_state' => $billing->getRegion(), 'address_country' => $billing->getCountry(), ), )); $payment ->setTransactionId($charge->id) ->setIsTransactionClosed(0); } catch (\Exception $e) { $this->debugData($e->getMessage()); $this->_logger->logException(__('Payment capturing error.')); throw new \Magento\Framework\Model\Exception(__('Payment capturing error.')); } return $this; } /** * Payment refund * * @param \Magento\Framework\Object $payment * @param float $amount * @return $this * @throws \Magento\Framework\Model\Exception */ public function refund(\Magento\Framework\Object $payment, $amount) { $transactionId = $payment->getParentTransactionId(); try { \Stripe_Charge::retrieve($transactionId)->refund(); } catch (\Exception $e) { $this->debugData($e->getMessage()); $this->_logger->logException(__('Payment refunding error.')); throw new \Magento\Framework\Model\Exception(__('Payment refunding error.')); } $payment ->setTransactionId($transactionId . '-' . \Magento\Sales\Model\Order\Payment\Transaction::TYPE_REFUND) ->setParentTransactionId($transactionId) ->setIsTransactionClosed(1) ->setShouldCloseParentTransaction(1); return $this; } /** * Determine method availability based on quote amount and config data * * @param null $quote * @return bool */ public function isAvailable($quote = null) { if ($quote && ( $quote->getBaseGrandTotal() < $this->_minAmount || ($this->_maxAmount && $quote->getBaseGrandTotal() > $this->_maxAmount)) ) { return false; } // if (!$this->getConfigData('api_key')) { // return false; // } return parent::isAvailable($quote); } /** * Availability for currency * * @param string $currencyCode * @return bool */ public function canUseForCurrency($currencyCode) { if (!in_array($currencyCode, $this->_supportedCurrencyCodes)) { return false; } return true; } }
本文章来为各位介绍php中Yaf框架集成zendframework2的例子,有兴趣的可以和一聚教程小编一起来看看,具体操作如下。
php框架 Yaf集成zendframework2, zf2的orm 可以作为独立模块用到yaf中,而且zf2 composer service manger cacheStorage 都可以集成到yaf中。
一:public\index.php 加入composer
chdir(dirname(__DIR__)); // Decline static file requests back to the PHP built-in webserver if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) { return false; } // Setup autoloading require 'init_autoloader.php'; // Define path to application directory define("APP_PATH", dirname(__DIR__)); // Create application, bootstrap, and run $app = new Yaf_Application(APP_PATH . "/conf/application.ini"); $app->bootstrap()->run();
根目录 存放 init_autoloader.php
二:导入ZF2 模块组件
vendor\ZF2 见页尾下载包
三:更改bootstrap配置文件
<?php use Zend\ServiceManager\ServiceManager; use Zend\Mvc\Service\ServiceManagerConfig; use Zend\ModuleManager\Listener\ConfigListener; use Zend\ModuleManager\Listener\ListenerOptions; use Zend\ModuleManager\ModuleEvent; class Bootstrap extends Yaf_Bootstrap_Abstract { public function _initConfig() { $config = Yaf_Application::app()->getConfig(); Yaf_Registry::set("config", $config); } public function _initServiceManager() { $configuration = require APP_PATH . '/conf/application.config.php'; $smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : array(); $serviceManager = new ServiceManager(new ServiceManagerConfig($smConfig)); $serviceManager->setService('ApplicationConfig', $configuration); $configListener = new ConfigListener(new ListenerOptions($configuration['module_listener_options'])); // If not found cache, merge config if (!$configListener->getMergedConfig(false)) $configListener->onMergeConfig(new ModuleEvent); // If enabled, update the config cache if ($configListener->getOptions()->getConfigCacheEnabled() && !file_exists($configListener->getOptions()->getConfigCacheFile())) { //echo "debug"; $configFile = $configListener->getOptions()->getConfigCacheFile(); $content = "<?php\nreturn " . var_export($configListener->getMergedConfig(false), 1) . ';'; file_put_contents($configFile, $content); } $serviceManager->setService('config', $configListener->getMergedConfig(false)); Yaf_Registry::set('ServiceManager', $serviceManager); } public function _initSessionManager() { Yaf_Registry::get('ServiceManager')->get('Zend\Session\SessionManager'); } public function _initPlugin(Yaf_Dispatcher $dispatcher) { $user = new UserPlugin(); $dispatcher->registerPlugin($user); } }
四:mvc测试
<?php use Zend\Session\Container as SessionContainer; use Zend\Db\TableGateway\TableGateway; class IndexController extends Yaf_Controller_Abstract { public function indexAction() { $adapter = $this->getDbAdapter(); $table = new TableGateway('zt_user', $adapter); $entities = $table->select(); foreach ($entities as $entity) { var_dump($entity->username); } $cache = $this->getStorage(); $cache->setItem('cache', 'cachedata'); echo $cache->getItem('cache'); $this->getLogger()->alert('log'); $this->getView()->assign("content", "Hello World"); } /** * db adapter * @return \Zend\Db\Adapter\Adapter */ public function getDbAdapter() { return Yaf_Registry::get('ServiceManager')->get('Zend\Db\Adapter\Adapter'); } /** * storage * @return \Zend\Cache\Storage\StorageInterface */ protected function getStorage() { return Yaf_Registry::get('ServiceManager')->get('Zend\Cache\Storage\StorageInterface'); } /** * logger * @return \Zend\Log\Zend\Log\Logger */ protected function getLogger() { return Yaf_Registry::get('ServiceManager')->get('Zend\Log\Logger'); } }
这样你访问public下的index.php 会输出hello word字样
相关文章
- 下面本文章来给大家介绍在php中成员变量的一些对比了,文章举了四个例子在这例子中分别对不同成员变量进行测试与获取操作,下面一起来看看。 有如下4个代码示例,你认...2016-11-25
- php 获取用户IP与IE信息程序 function onlineip() { global $_SERVER; if(getenv('HTTP_CLIENT_IP')) { $onlineip = getenv('HTTP_CLIENT_IP');...2016-11-25
- php获取一个文件夹的mtime的程序了,这个就是时间问题了,对于这个问题我们来看小编整理的几个例子,具体的操作例子如下所示。 php很容易获取到一个文件夹的mtime,可以...2016-11-25
- 这篇文章主要介绍了Vue基于localStorage存储信息代码实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下...2020-11-16
- 获取网站icon,常用最简单的方法就是通过website/favicon.ico来获取,不过由于很多网站都是在页面里面设置favicon,所以此方法很多情况都不可用。 更好的办法是通过google提供的服务来实现:http://www.google.com/s2/favi...2014-06-07
- 主要功能:获取浏览器显示区域(可视区域)的高度 : $(window).height(); 获取浏览器显示区域(可视区域)的宽度 :$(window).width(); 获取页面的文档高度 $(document).height(); 获取页面的文档宽度 :$(document).width();...2015-10-21
- jquery中jquery.offset().top / left用于获取div距离窗口的距离,jquery.position().top / left 用于获取距离父级div的距离(必须是绝对定位的div)。 (1)先介绍jquery.offset().top / left css: 复制代码 代码如下: *{ mar...2013-10-13
- 1、先讲讲JQuery的概念,JQuery首先是由一个 America 的叫什么 John Resig的人创建的,后来又很多的JS高手也加入了这个团队。其实 JQuery是一个JavaScript的类库,这个类库集合了很多功能方法,利用类库你可以用简单的一些代...2014-05-31
- 这篇文章主要介绍了C#获取字符串后几位数的方法,实例分析了C#操作字符串的技巧,具有一定参考借鉴价值,需要的朋友可以参考下...2020-06-25
- 如果是为了取到tagName后再进行判断,那直接用下面的代码会更方便: $(element).is('input') 如果是要取到标签用作到别的地方,可以使用一下代码: $(element)[0].tagName 或: $(element).get(0).tagName...2014-05-31
- 复制代码 代码如下:$nodes = @$xpath->query("//*[@id='main_pr']/img/@src");$prurl = $nodes->item(0)->nodeValue;...2013-10-04
- 本文为代码分享,也是在工作中看到一些“大牛”的代码,做做分享。 具体是这样的,如下一个二维数组,是从库中读取出来的。 代码清单: 复制代码 代码如下: $user = array( 0 => array( 'id' => 1, 'name' => '张三', 'ema...2014-06-07
- 现实中我们经常看到这样的说明,排名不分先后,按姓名首字母进行排序。这是中国人大多数使用的排序方法。那么在php程序中该如何操作呢?下面就分享一下在php程序中获取汉字拼音的首字母的方法,在网上搜到的大多数是有问题的...2015-10-23
- 本篇文章是对使用C#获取系统特殊文件夹路径的解决方法进行了详细的分析介绍,需要的朋友参考下...2020-06-25
C#利用System.Threading.Thread.Sleep即时输出信息的详解
本篇文章是对C#利用System.Threading.Thread.Sleep即时输出信息进行了详细的分析介绍,需要的朋友参考下...2020-06-25- 网上也有很多类似的方法,不过都存在这样那样的不严谨的问题,本文就不一一分析了,这里只给出最正确的利用php 获取文件扩展名(文件后缀名)的方法。 function get_extension($filename){ return pathinfo($filename,PATHIN...2015-10-30
- 这篇文章主要介绍了C# 获取硬盘号,CPU信息,加密解密技术的步骤,帮助大家更好的理解和学习c#,感兴趣的朋友可以了解下...2021-01-16
- Redis 是一个开源、高性能的Key-Value数据库,被广泛应用在服务器各种场景中。本文介绍几个查看Redis内存信息的命令,包括常用的info memory、info keyspace、bigkeys等。...2021-01-15
- 这篇文章主要介绍了基于JavaScript获取鼠标位置的各种方法 ,需要的朋友可以参考下...2015-12-18
- 这篇文章主要介绍了C#获取变更过的DataTable记录的实现方法,对初学者很有学习借鉴价值,需要的朋友可以参考下...2020-06-25