简体   繁体   English

如何在一个函数中使用不同的字符串值?

[英]How can i use different string value's in one function?

First i am a beginner in programming in general, i am trying to create a program for using gps locations from Lightroom on a map in googlemaps. 首先,我通常是编程的初学者,我试图创建一个程序来使用Lightroom在googlemaps中的地图上的gps位置。

When i use the print the strings below ti the screen i see 5 different value's, this is also what i want, but... 当我使用屏幕下方的字符串打印时,我看到5个不同的值,这也是我想要的,但是...

I want to create also 5 different markers on the map this is done by the addMarkerByCoords Function but how can i use the 5 value per strings in the function ? 我也想在地图上创建5个不同的标记,这是通过addMarkerByCoords函数完成的,但是如何在函数中使用每个字符串的5个值呢?

I have tried array, foreach but i cannot getting to work. 我已经尝试了数组,foreach但我无法上班。 The not working part can and probably will be my fault. 不能正常工作的部分可能并且很可能是我的错。 LOL 大声笑

 print_r ("$Loncoord");
 print_r ("$Latcoord");
 print_r ("$gui");

//$map->formatOutput = true;

  $map->addMarkerByCoords("$Loncoord","$Latcoord","$gui",'<b>Old Chicago</b>');

Can somebody give me a hint ? 有人可以给我提示吗?

To: Jonathan Sampson: outputs print_r :-5.68166666667, +24.6513888889,IMG_3308,index.html,Landschap 至:乔纳森·桑普森(Jonathan Sampson):输出print_r:-5.68166666667,+ 24.6513888889,IMG_3308,index.html,Landschap

To: Anti Veeranna I removed the " marks (and the program still works), but can you explain why this is better ? 若要:反Veeranna我删除了“标记(该程序仍然有效),但是您能解释一下为什么这样更好吗?

And to the others Thank you very very much for the effort,work and really quick responses. 和其他人非常感谢您的努力,工作和迅速的回复。

Assuming that this is PHP, you could us an array of arrays, and then loop. 假设这是PHP,则可以给我们一个数组数组,然后循环。

Something like this: 像这样:

$items = array(
    array( 
      'long'     => 12.34567,
      'lat'      => 34.56789,
      'gui'      => '????',
      'location' => 'old chicago'
    ),

    ...

    array( 
      'long'     => 12.34567,
      'lat'      => 34.56789,
      'gui'      => '????',
      'location' => 'old chicago 5'
    )
);

foreach ($items as &$item) {
    $map->addMarkerByCoords(
         $item['long'],
         $item['lat'],
         $item['gui'],
         $item['location']
    );
}

unset($item);
$map->addMarkerByCoords(Array($Loncoord, $Latcoord, $gui, '<b>Old Chicago</b>));

??

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何将这两个功能合二为一 - How can i use both function in one Google的不同令牌类型之间有什么关系? 以及如何在其PHP库中使用字符串令牌? - What's the relationship between google's different token types? And how can I use the string token with their PHP lib? 如何在UNIX时间戳中转换日期值,以便可以使用php的date函数? - How can I convert my date value in a unix timestamp so I can use php's date function? 如何为一个域使用两种不同的托管 - How can I use two different hosting for one domain 如何在Wordpress的不同页面上使用一个模板? - How can i use one template on different pages in wordpress? 如何在另一个函数中使用一个函数值? - How to use one function value in another function? 如何将date_diff函数与字符串值一起使用 - How can i use date_diff function with string values 在函数中使用不同的字符串? - use different string in function? 如何通过 Nginx 为不同的 PHP 使用不同的 PHP-FPM 池? - How can I use different PHP-FPM pools for different PHP's with Nginx? 我可以在一行中的同一类的方法中将类变量用作变量函数吗? - Can i use a class variable as variable function inside the same class's method in one single line?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM