0

I have something like the following in a Netbeans code template:

/**
 * stuff 
 */
$name = '${name}';
array('${var1 default="persons_${name}"}');

How can I make the default value for var1 actually expand the name variable as input in the preceding line when using the code template?

I expect to get:

/**
 * stuff 
 */
$name = 'joseph';
array('person_joseph');

When I fill in joseph for the name variable.

4

1 回答 1

0

看起来您的问题不在于扩展${name},而在于指定默认值。假设你想得到person_josephwhen var1isnull或 undefined 它应该是:

array('${var1!"persons_${name}"}');
于 2012-08-31T06:58:05.483 回答