我在index.html的.js文件中有以下函数
function getValues(){
$.ajax({
type: 'POST',
url: "http://localhost/getData/getdata.php",
success: function(data){
var dataValues;
var apnd;
dataValues = String(data.NSE);
apnd = "a";
updateValues(dataValues, apnd);
dataValues = String(data.BSE);
apnd = "b";
updateValues(dataValues, apnd);
},
dataType: "json"
});
}
Run Code Online (Sandbox Code Playgroud)
当我在像wamp这样的网络服务器中运行它时,这很好用.但是我想在本地运行index.html,即没有网络服务器,用户只需双击index.html即可运行,但事实并非如此.数据始终为空.可能是什么问题呢?对不起,我是一个超级JQuery Noob.
getdata.php文件中的代码是
<?
echo json_encode(array("NSE"=>rand(5000, 20000),"BSE"=>rand(5000, 20000)));
?>
Run Code Online (Sandbox Code Playgroud) 如何在PHP中将HEX颜色值转换为CMYK等效值?
我想写一个能做到这一点的函数.但我不知道如何将十六进制转换为CMYK
eg:
<?php
hex2CMYK('#000000'); //result: array('0.0','0.0','0.0','0.0');
?>
Run Code Online (Sandbox Code Playgroud)