html, css и javascript1   Разное1   Рецепты программирования на PHP или практические советы по программированию7   Управление проектом1  


Рецепты программирования на PHP или практические советы по программированию → Слеш в конце пути

Часто возникает задачка проверить есть ли в конце пути слеш или нет. Чтобы не париться над этим каждый раз, достаточно использовать простую функцию

1 //добавляет слеш в конец пути если его нет
2 function n($path) {
3     return in_array(substr($path,-1),array("\","/")) ? $path $path."/";
4 }

Можно также использовать и регулярные выражения:

1 function nr($path) {
2     return preg_match("/\/$/",$path) ? $path $path."/";
3 }


30.04.2016 → Makendra написал:
Congratulations on your 30th Anniversary, Nancy! Has it really been that long?? LOL! I’ve watched your show through many years of making clothes for my children, doll clothes for their dolls, dance outfits, and school play/Halloween costumes. In everything I’ve done, I can credit one of your shows for inspiration. So, no fau3#ites&r82o0;.jvst all of them are favorites! Also, thank you so much for the time saving tips that you continue to provide. You are my sewing hero!!! http://gnrjdviuxi.com [url=http://stievrmomoy.com]stievrmomoy[/url] [link=http://qspqebsxgfv.com]qspqebsxgfv[/link]

29.04.2016 → Matty написал:
The print version of the Sunday Mirror also had the same story (top MP soon to be arrested in Vice Paedo ring etc.), but there is no online link....The story had it that this top <a href="http://xwxxrs.com">MPMes-/inixter</a> would be arrested in the next few weeks, but somehow I doubt it.Hmmm

29.04.2016 → Betty написал:
First of all, if you want to comment to sonmoee, make sure you hit the REPLY button. 2nd, its:Oh Hawai&#8217;i, Oh sands of my birthMy native homeI rejoice in the blessings of heavenOh Hawai&#8217;i, aloha.Happy youth of HaaRi&#8217;iwejoice! Rejoice!Gentle breezes blowLove always for Hawai&#8217;i http://gcnhjxoblrs.com [url=http://thmyzt.com]thmyzt[/url] [link=http://zqfwxw.com]zqfwxw[/link]

28.04.2016 → Tangela написал:
Hello! This is kind of off topic but I need some help from an established blog. Is it tough to set up your own blog? I&#8217;m not very techincal but I can figure things out pretty fast. I&#8217;m thinking about making my own but I&#8217;m not sure where to begin. Do you have any tips or <a href="http://ohwdcfdcoad.com">sugitsegons?</a> With thanks

27.04.2016 → Lisa написал:
Fidnnig this post has solved my problem

14.07.2015 → Simo написал:
I'm relaly into it, thanks for this great stuff! http://htqghivov.com [url=http://tnobvfivqte.com]tnobvfivqte[/url] [link=http://acfhgmqrru.com]acfhgmqrru[/link]

12.07.2015 → Bishnu написал:
Never would have thunk I would find this so <a href="http://kteflfozta.com">inesipdnsable.</a>

10.07.2015 → Bubi написал:
The'ers nothing like the relief of finding what you're looking for. http://gifacgqkrij.com [url=http://mmjkeyto.com]mmjkeyto[/url] [link=http://kwnqgjr.com]kwnqgjr[/link]

08.07.2015 → Karah написал:
Ab fab my <a href="http://divhihv.com">goldoy</a> man.

07.07.2015 → Monisha написал:
This site is like a clroasosm, except I don't hate it. lol

25.11.2014 → ????????? написал:
Слеш в конце пути ???? ????????? [url=http://jclawoffice.com/content/image/ink.html]?????????[/url]

19.10.2012 → ipaudhyeeg написал:
i3lXx1 , [url=http://amzmiohhrdpg.com/]amzmiohhrdpg[/url], [link=http://ifllktotbmwx.com/]ifllktotbmwx[/link], http://yiceyjbmvret.com/

16.10.2012 → urrtdxlrbqi написал:
XTTyUf <a href="http://wuekqtnohhbh.com/">wuekqtnohhbh</a>

15.10.2012 → zxayjkjhzwn написал:
rW3klA , [url=http://iequqckqnjkx.com/]iequqckqnjkx[/url], [link=http://iyvekkapknuw.com/]iyvekkapknuw[/link], http://jycsuuyzufsp.com/

15.10.2012 → aqoaan написал:
uC3jtA <a href="http://wrwjakewjqsp.com/">wrwjakewjqsp</a>

14.10.2012 → Paula написал:
I will be putitng this dazzling insight to good use in no time.

Написать комментарий

Включите отображение картинок в браузере
Число на картинке: