无法在cakephp2中设置并获取$ _GET

时间:2017-05-24 02:36:03

标签: php get cakephp-2.0 http-request-parameters

我希望在view.ctp中有以下条件。我想从网址获取“/?parameters = name& data = 1”等参数,并将其放在我的视图中。我想设置一个$ _GET。我在哪里可以设置它?控制器,元素,lor查看?我阅读了多个教程,但我仍然不知道$ _GET在Cakephp2中是如何工作的。如果你能给我像我这样的假人的样品或提示,那将是很棒的。

if(!empty($_GET['parameter'])){

}

1 个答案:

答案 0 :(得分:1)

您的代码中

int i = 0; float[] que = new float[a.length]; //Queue<Float> que = new PriorityQueue<Float>(); while (i < a.length){ addarray(que, a[i], i); i++; } i = 0; while (i<que.length){ // System.out.println(que[i]); i++; } int qlength = que.length-1; //System.out.println("now to add"); i = 0; float result = 0; int clength = qlength; while (qlength > 0){ float x = que[0]; que[0] = que[qlength]; //removelast(que); i = 0; clength--; float[] temp = new float[que.length -1]; while (i < que.length -1){ temp[i] = que[i]; i++; } i=0; que = new float[que.length-1]; while (i < que.length){ que[i] = temp[i]; //System.out.println(que[i]); i++; } pulldown(que, 0); float y = que[0]; que[0] = que[qlength-1]; clength--; //removelast(que); i = 0; temp = new float[que.length -1]; while (i < que.length -1){ temp[i] = que[i]; i++; } i=0; que = new float[que.length-1]; while (i < que.length){ que[i] = temp[i]; //System.out.println(que[i]); i++; } if (que.length != 0){ pulldown(que, 0);} System.out.println("adding " + x + " and " + y); float z = x+y; System.out.println("z = " + z); //append(que, z); i = 0; temp = new float[que.length+1]; while (i < que.length){ temp[i] = que[i]; i++; } addarray(temp, z, temp.length-1); i=0; que = new float[temp.length]; while (i < que.length){ que[i] = temp[i]; //System.out.println(que[i]); i++; } clength++; qlength--; } return que[0]; 应为<input type="text" id="firstName" onkeypress="return (event.charCode >= 65 && event.charCode <= 90) || (event.charCode >= 97 && event.charCode <= 122) || (event.charCode >= 48 && event.charCode <= 57)" />。对于$_GET['parameter']