如何生成'a href =“javascript:void(0)”'像cakephp中的链接?(How to generate 'a href=“javascript:void(0)”' like link in cakephp?)
如何生成'a href =“javascript:void(0)”'像CakePHP中的链接?
我创建了一个应用程序,当用户单击图像列表时,内容将插入到编辑器textarea中。 我在这些图像中添加了一个类,并在javascript文件中编写了一些代码。 一切进行得都很顺利。
但是图像的链接是一个URL地址,但不像URL那样'href =“javascript:void(0)'。任何人都可以告诉我如何在CakePHP中创建它?
提前致谢!
How to generate 'a href="javascript:void(0)"' like link in CakePHP?
I make an application, the content will insert into the editor textarea when user click a list of image. I add a class to these images and write some code in the javascript file. Everything is going well.
But the link of the image is a URL address, but not 'href="javascript:void(0)' like URL. Anyone could tell me how to make it in CakePHP?
Thanks in advance!
原文:https://stackoverflow.com/questions/7278278
最满意答案
然后你需要写
string *array = new string("value");
虽然你最好使用
string array = "value";
因为这是使用它的预期方式。 否则你需要跟踪记忆。
you would then need to write
string *array = new string("value");
although you are better off using
string array = "value";
as that is the intended way to use it. otherwise you need to keep track of memory.
相关问答
更多-
Segfault可能由许多事情引起。 你是否检查malloc之后的指针(如果它是NULL)? 逐步查看代码的行数,确切了解它发生的位置(并通过更多细节和代码提出一个单独的问题) 你似乎没有理解C中指针和数组的关系。首先,指向数组指针的指针被定义为type***或type** []。 实际上,只有两次间接指针是有用的。 尽管如此,你可以拥有这样的东西,只需引用足够的指针并进行实际的内存分配即可。 这很混乱。 应该是一个单独的问题。 他们很可能会崩溃你的程序,但这是不确定的,所以你不能确定。 他们可能有一个已经 ...
-
这是怎么做的: func Initialize(v interface{}) { rv := reflect.ValueOf(v).Elem() rv.Set(reflect.New(rv.Type().Elem())) } 必须使用指向要设置的值的指针调用此函数: Initialize(&val) 操场的例子 如果参数类型不是指向指针的指针,则此答案中的代码会发生混乱。 根据您的使用情况,您可能需要在调用Elem()之前检查反射值 类型 。 Here's how to do it: func ...
-
请记住,C中的字符串由空终止符字符结束 ,写为\0 。 如果在指针变量中存储了格式正确的字符串,则可以通过搜索此字符来确定长度: char *x = "hello"; // automatically appends a null terminator int len = 0; while (x[len] != '\0') { len++; } 如果你的变量未初始化或者格式不正确(例如,通过为NULL ),你显然不能采用这种方法; 但是,大多数函数通常是在字符串格式正确的假设下编写的,因为这会导致 ...
-
这应该这样做: char **array = malloc(1 * sizeof *array); array[0] = NULL; 这假设分配成功,您应该在实际代码中依赖它之前测试它。 1表示“1个元素的数组”,它当然是多余的,但我觉得它增加了一些清晰度。 上面声明了一个指向(数组)字符指针的指针,并尝试为1这样的字符指针分配空间。 实际上这样做似乎毫无意义,但我无法理解你的想法,想弄你应该做些什么。 :) This should do it: char **array = malloc(1 * siz ...
-
如何初始化字符串指针?(how to initialize string pointer?)[2022-09-22]
然后你需要写 string *array = new string("value"); 虽然你最好使用 string array = "value"; 因为这是使用它的预期方式。 否则你需要跟踪记忆。 you would then need to write string *array = new string("value"); although you are better off using string array = "value"; as that is the intended way ... -
如果您发布实际错误会有所帮助,但是,您的类型错误,所以这可能是问题所在。 相反,尝试: static const char* new_var = array[0]; Would be helpful if you posted the actual error, but, your types were wrong, so that's probably the problem. Instead, try: static const char* new_var = array[0];
-
user_str : String(1..50) := (others => Character'Val(0)); 要么 user_str : String(1..50) := (others => Ada.Characters.Latin_1.NUL); 与其他一些语言不同,Ada没有特殊的语法来将特定字符嵌入到字符或字符串文字中(例如C的'\0' )。 (当然后者需要适当with条款。) user_str : String(1..50) := (others => Character'Val(0)) ...
-
除非指定给变量,否则指针不可寻址。 将复合文字的地址不分配给变量的能力仅限于结构体,数组,切片和贴图。 要做你想做的事情,你必须首先将指针分配给一个变量,之后你可以在结构体文本中指定该变量(指针)的地址: https://play.golang.org/p/7WyS732H3cZ package main type atype struct { val string } func main() { at := &atype{ val: "test", } ...
-
char *ptr = "Hello OP!!"; ptr是指向存储在RODATA段中的字符串文字的第一个char的指针。 当您取消引用它时,您只能读取而不能写入值,因为字符串文字是常量字符数组。 char arr[] = "Hello OP!! How are you my friend?"; 在这种情况下: 是为大小文字长度的arr数组分配空间,包括尾随零。 字符串文字被复制到为arr数组分配的空间中 在这种情况下,arr用作内存中复制字符串文字的位置。 您可以读写,因为arr元素是可读写的 现在回 ...
-
实际上,无论使用第一个还是第二个选项,都与数组本身无关。 第二个选项不会导致任何更改,即使数组是可变的并且您在索引1处替换了对象。 string仍将指向原始对象。 在您给出的示例中,两个选项的选择仅在实际中,您从数组中获取的字符串是NSMutableString 。 如果字符串是不可变的NSString那么任一选项都会给出相同的结果。 但是如果你实际上有一个可变的NSMutableString ,那么选项2意味着你的string值可以随着时间的推移而改变,对可变字符串的另一个引用会改变字符串。 例: NSM ...