我有一个简单的xml对象数组.我正在写下面的代码
Array
(
[ID] => 1992109
[Title] => A Equipa do MAIS
[Description] => SimpleXMLElement Object
(
)
)
Run Code Online (Sandbox Code Playgroud)
现在,我如何检查此数组中的描述值,如果存在或不存在值的值.
NodeJS代码:
const salt = new Buffer('GHlDHToiZA1ViUu+W+EXww==', 'base64');
Run Code Online (Sandbox Code Playgroud)
输出如下:
<Buffer 18 79 43 1d 3a 22 64 0d 55 89 4b be 5b e1 17 c3>
Run Code Online (Sandbox Code Playgroud)
我需要在 PHP 中得到相同的输出。读过一些关于 PHPpack函数的文章,但我不知道如何使用它。
我有一个像定义一样的常量("EMPLOYEE_NAME_ID","员工"); 和变量$ code = EMPLOYEE;
现在我想打印如下
<?php echo $code.NAME_ID; ?>
Run Code Online (Sandbox Code Playgroud)
但这只打印"EMPLOYEE_NAME_ID",我想打印"员工".然后如何打印这个.全部意味着我想从lang文件中查看变量.
我正在制作一个需要显示视频的html页面.视频的网址在jsondecode输出中找到.有没有办法从该JSON输出中选择片段并在我的html页面中使用它?我已经尝试过POST和GET和echo,但似乎没有用.
要明确:我正试图从php文件到单独的HTML文件.
该JSON反应是在功能的单独的文件中.
public function getURL(){
$server_url= ilObjPresentations2GoGUI::getServerUrl();
$secret_key= ilObjPresentations2GoGUI::getSecretKey();
$authorized_group= ilObjPresentations2GoGUI::getAuthorizedGroup();
$link_usable= ilObjPresentations2GoGUI::getLinkUsable();
$query = 'technology';
$date = new DateTime('NOW');
$ts = $date->format('Y-m-d\TH:i:s');
$interval = 'PT' . $this->link_usable . 'H';
$date->add(new DateInterval('PT' . $link_usable . 'H'));
$expired = $date->format('Y-m-d\TH:i:s');
$url = $server_url . '?action=search&query='. $query . '&group='. $authorized_group . '&ts=' . $ts . '&expired=' .$expired;
$token = ilObjPresentations2GoAPI::create($url,$secret_key);
$goodurl = $url . '&token=' . $token;
$json = file_get_contents($goodurl);
$the_data = json_decode($json, true);}
Run Code Online (Sandbox Code Playgroud)
输出: …
我有以下DOM结构:
<label>
<span class="tt">
<a href="#" class="editable">Hello1</a>
<a href="#" class="editable">Hello2</a>
<a href="#" class="editable">Hello3</a>
<a href="#" class="editable">Hello4</a>
</span>
<a href="#" class="editable">Hello5</a>
</label>
Run Code Online (Sandbox Code Playgroud)
当我点击锚点时Hello3,我需要得到Hello4它的工作绝对正常.但如果我点击链接Hello4,我需要得到Hello5哪些我没有得到正确的.
我正在使用以下代码:
$(document).on('click','.editable',function(){
console.log($(this).nextAll('.editable').first());
});
Run Code Online (Sandbox Code Playgroud)
我真正想要的是editable当我点击一个锚时,让下一个元素在label标签中有类.
我知道javascript是单线程的,并且一次运行一个任务或语句.但是javascript的Run to Completion性质让我感到困惑.我有以下代码:
console.log('1');
setTimeout(function() {
console.log('2');
setTimeout(function() {
console.log('3');
},0);
},0);
console.log('5');
Run Code Online (Sandbox Code Playgroud)
我期望输出如下:
1
2
3
5
Run Code Online (Sandbox Code Playgroud)
但它正在给予
1
5
2
3
Run Code Online (Sandbox Code Playgroud)
即使我在所有计时器中都是零毫秒,它的表现如何.所以它应该一个接一个地执行,而不是因为零毫秒而等待任何事情.
有人可以向我解释一下这件事.万分感激.
我在 php 中有一个数组,如下所示
Array
(
[0] => Array
(
[0] => 40173
[1] => 514081
[2] => 363885
[3] => 891382
),
[1] => Array
(
[0] => 40173
[1] => 5181
[2] => 385
[3] => 891382
)
)
Run Code Online (Sandbox Code Playgroud)
现在我想删除父索引 0,1... 并最终想要获取所有值(只有唯一值)。
谢谢。
我编写了以下代码,但它将拒绝而不是解决回调.
(function() {
var restante = 0;
'use strict';
function wait() {
return new Promise(function(done, reject) {
setTimeout(function() {
if (restante = 0) {
done();
} else {
reject();
}
}, 2000);
});
}
wait().
then(function() {
console.log("First Resolution");
}).catch(function() {
console.log("Error occured");
});
})();
Run Code Online (Sandbox Code Playgroud)
为什么每次都拒绝?
我有一个包含文本框的 sweetalert 框。sweetalert 在引导模式框中打开。在 Firefox 中,我尝试单击文本框,但它没有获得焦点。
这是我的甜蜜警报代码:
swal(
{
title: "Create New Design",
input: "text",
showCancelButton: true,
inputPlaceholder: "Title",
preConfirm: function(input)
{
// code to validate the input
}
});
Run Code Online (Sandbox Code Playgroud)
这是屏幕截图:
php ×5
javascript ×3
arrays ×2
array-unique ×1
buffer ×1
dom ×1
firefox ×1
global ×1
html ×1
jquery ×1
json ×1
lang ×1
nextsibling ×1
node.js ×1
object ×1
promise ×1
simplexml ×1
sweetalert ×1
sweetalert2 ×1
variables ×1
xml ×1