小编Abu*_*zzy的帖子

将多个变量传递到url中的另一个页面

我正在使用这样的会话将一个变量传递到url中的另一个页面,但似乎我无法将另一个变量连接到同一个url并在下一页中成功检索它

第1页

session_start();
$event_id = $_SESSION['event_id'];
echo $event_id;

$url = "http://localhost/main.php?email=" . $email_address . $event_id;     
Run Code Online (Sandbox Code Playgroud)

第2页

if (isset($_GET['event_id'])) {
$event_id = $_GET['event_id'];}
echo $event_id;
Run Code Online (Sandbox Code Playgroud)

echo $event_idUndefined variable在第2页显示错误,但如果我event_id$url这里使用类似的

 $url = "http://localhost/main.php?event_id=" . $event_id;
Run Code Online (Sandbox Code Playgroud)

这工作正常,但我需要能够在url中使用这两个变量,以便第2页可以检索获取它们.

php variables url session

35
推荐指数
3
解决办法
28万
查看次数

如何使选择列表的输出依赖于父列表?

我有两个具有父类别和子类别的数组,每个数组都出现在一个选择列表中,如何使子类别仅显示其父类别中的项目?

 <?php $carMakes = array(
 'show_option_all'    => '',
 'show_option_none'   => ('All Makes'),
 'orderby'            => 'ID', 
 'order'              => 'ASC',
 'show_count'         => 0,
 'hide_empty'         => 1, 
 'child_of'           => 25,
 'exclude'            => 0,
 'echo'               => 1,
 'selected'           => 0,
 'hierarchical'       => 0, 
 'name'               => 'cat',
 'id'                 => '',
 'class'              => 'postform',
 'depth'              => 0,
 'tab_index'          => 0,
 'taxonomy'           => 'category',
 'hide_if_empty'      => false
); ?>

<?php $carModels = array(
 'name'               => 'subcat',
 'hierarchical'       => 1,
 'parent'             => get_cat_id('model'),
 'show_option_none'   => ('All Models'),
 'hide_empty' …
Run Code Online (Sandbox Code Playgroud)

php wordpress

8
推荐指数
1
解决办法
2602
查看次数

是否可以从JavaScript注入的内联样式中减去一个数字?

我有一个内联样式添加到HTML,如style="left: 10px;".我可以加/减这个数字吗?

我想创建一个规则,8px无论数字是什么,我都可以删除该数字.

我尝试使用丑陋的!important黑客来覆盖它,但是当初始值改变时,这没有帮助.

html javascript jquery

5
推荐指数
2
解决办法
462
查看次数

Puppeteer 获取数据属性包含选择器

本地主机上的标记

<ul>
 <li>
  <button data-action-trigger="btn1">Button text</button>
 </li>
</ul>
Run Code Online (Sandbox Code Playgroud)

我需要btn1通过选择它及其data-attribute值来单击btn ,我在console.log

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  page.setViewport({width: 1440, height: 1200})
  await page.goto('http://localhost:3000/index.html')

  const data = await page.content();

  const btnAction = await page.evaluate(
      () => document.querySelector('[data-action-trigger*="btn1"]'))

  console.log(btnAction) //{}

  await browser.close();
})();
Run Code Online (Sandbox Code Playgroud)

我可以选择 Chrome devTools 元素作为

document.querySelector(`[data-action-trigger*="btn1"]`)
<button data-action-trigger="btn1">Button text</button>
Run Code Online (Sandbox Code Playgroud)

javascript node.js puppeteer

5
推荐指数
1
解决办法
6817
查看次数

如何使用CSS将<ul>显示为两个并排列?

如何制作包含3行的2列?

<ul>

<li>Item-1</li>
<li>Item-2</li>
<li>Item-3</li>

<li>Item-4</li>
<li>Item-5</li>
<li>Item-6</li>

</ul>
Run Code Online (Sandbox Code Playgroud)

谢谢

html css markup

3
推荐指数
1
解决办法
1万
查看次数

如何使用正则表达式查找大于100%的值?

我正在处理几个文件中的大量CSS,并试图调试布局问题,寻找像 width:105%

我只能在支持搜索中的正则表达式的Windows机器上访问notepad ++.

css regex notepad++

3
推荐指数
1
解决办法
1359
查看次数

我怎么能避免将双重空格计为单词?

$(document).ready(function() {

    $("[class^='count[']").each(function() {

        var elClass = $(this).attr('class');
        var minWords = 0;
        var maxWords = 0;
        var countControl = elClass.substring((elClass.indexOf('['))+1, elClass.lastIndexOf(']')).split(',');

        if(countControl.length > 1) {

            minWords = countControl[0];
            maxWords = countControl[1];

        } 

        else { maxWords = countControl[0]; }



        $(this).after('<div class="wordCount"><strong>0</strong> words so far</div>');

            if(minWords > 0) {
                                $(this).siblings('.wordCount').addClass('error');
                             }

        $(this).bind('keyup click blur focus change paste', function() {

            var numWords = jQuery.trim($(this).val()).split(' ').length;
                if($(this).val() === '') {
                        numWords = 0;
                    }

        $(this).siblings('.wordCount').children('strong').text(numWords);
            if(numWords < minWords || (numWords > maxWords && maxWords …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-ui

2
推荐指数
1
解决办法
405
查看次数

将子href的点击功能绑定到父div

<div class="parent">
   <a href="#">download link</a>
</div>


$(".parent").bind("click", function(){

alert('test');

});
Run Code Online (Sandbox Code Playgroud)

想绑定href click函数,以便在单击.parent时,它会转到嵌套链接的位置.

html javascript jquery

2
推荐指数
2
解决办法
2794
查看次数

我怎样才能让php读取5行而不是整个.csv文件?

$file_handle = fopen("ticker.csv", "r");  while (!feof($file_handle) ) {

  $line_of_text = fgetcsv($file_handle, 1024);

  print '<div class="ticker_price">'. $line_of_text[7] . "</div>";
                                                                                                       }
fclose($file_handle);
Run Code Online (Sandbox Code Playgroud)

如何从.csv文件内的第7列中读取有限的行数

php

1
推荐指数
1
解决办法
2568
查看次数

这两种在JavaScript中编写原型函数的方法有什么区别

Myfunction.prototype.updateMyFunction = function() {

 //do something

};

Myfunction.prototype = {

 updateMyfunction: function() {

  //do something

 }

};
Run Code Online (Sandbox Code Playgroud)

它们都产生相同的结果

javascript oop

1
推荐指数
1
解决办法
50
查看次数

标签 统计

javascript ×5

html ×3

jquery ×3

php ×3

css ×2

jquery-ui ×1

markup ×1

node.js ×1

notepad++ ×1

oop ×1

puppeteer ×1

regex ×1

session ×1

url ×1

variables ×1

wordpress ×1