rausis Posted June 18, 2008 Report Share Posted June 18, 2008 (edited) Ko dara @ simbols pirms funkcijām? Piemērs: @mysql_query(), @session_start().. utt. Kāda tam nozīme un kādos gadījumos viņu izmanto? Iekš google neko nepratu sameklēt, jo meklētāji @ simbolu nesagremo, neko nesameklēju, tādēļ jautāju šeit. Pateicos par info. :) Edited June 18, 2008 by rausis Link to comment Share on other sites More sharing options...
Val Posted June 18, 2008 Report Share Posted June 18, 2008 http://lv.php.net/operators.errorcontrol Link to comment Share on other sites More sharing options...
Paulinjsh Posted June 18, 2008 Report Share Posted June 18, 2008 @ vispār ir evil, labāk iztiekam bez tā.. Link to comment Share on other sites More sharing options...
pilots Posted June 19, 2008 Report Share Posted June 19, 2008 (edited) errorus tad neatgriež. kaut kas līdzīgs, ja funkcija sapišās un tā vietā lai izvadītu penteri, ka errors vienkārši skipojam. tālāk gan viss turpina izpildīties. man ar šur tur kodos stāv simbols @ piemēram, priekšā mysql_queryiem .. tādēļ labprāt uzzinātu kādēļ tas ir `evil`? :) Edited June 19, 2008 by pilots Link to comment Share on other sites More sharing options...
Paulinjsh Posted June 19, 2008 Report Share Posted June 19, 2008 tāpēc, ka @ prasa daudz sistēmas resursu. Link to comment Share on other sites More sharing options...
andrisp Posted June 19, 2008 Report Share Posted June 19, 2008 Viens no iemesliem ir taads, ka tas prasa papildus resursus PHP interpretatoram. Tas ir - teoreetiski skripts paliek leenaaks. Otrs - tas reaali apgruutina debugoshanu, jo lai arii tu ieksh php.ini iesleegtu visus error_reporting liimenjus, taapat tos errors, kas ir pasleepti ar @, nekad neredzeesi. (Tad gan vajag izmantot error logu). Link to comment Share on other sites More sharing options...
Grey_Wolf Posted June 19, 2008 Report Share Posted June 19, 2008 (edited) Viens no iemesliem ir taads, ka tas prasa papildus resursus PHP interpretatoram. ??? tas ir 1 lieka simbola/darbibas apstraade ;) Vienigais iemesls kapec vinju nevajag izmantot ir Debugosana ..... gala varianta vinju var izmantot, tikai pie izmantosanas jatceras ka Kljudas apstrade javeic pasam ..... piemers : $parbaude= @include('bla.php'); if($parbaude==false) { echo 'Fails bla.php naff....'; } else { // megjinam dariit ko citu ... } ---- izmantosanas labums ir taads ka Gala Lietotaajs Nekad neredzees standart kljudas pazinjojumu (kautgan labak ir izslegt kljudu izvadi uz ekrana ...) Edited June 19, 2008 by Grey_Wolf Link to comment Share on other sites More sharing options...
andrisp Posted June 19, 2008 Report Share Posted June 19, 2008 Grey_Wolf, tavaas aciis tas ir tikai viens simbols, bet php interpretaators to redz savaadaak. Kaut kur lasiiju/dzirdeeju, ka kad tiek izsaukts kaut kas ar @ priekshaa, tad PHP pusee norisinaas vesela opera. Tikai kaut kaa tagad nesanaak atrast sourci, kur to lasiiju. Link to comment Share on other sites More sharing options...
bubu Posted June 19, 2008 Report Share Posted June 19, 2008 Grey_Wolf: tavu @include piemēru var ļoti viegli uzrakstīt izmantojot file_exists fju. Un nav nekāds @ nepieciešams. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted June 19, 2008 Report Share Posted June 19, 2008 bubu --> tas jaa, tik atrumaa uzrakstiju kaa piemeru ..... Link to comment Share on other sites More sharing options...
rausis Posted June 19, 2008 Author Report Share Posted June 19, 2008 pateicos par info :) Link to comment Share on other sites More sharing options...
martins256 Posted June 19, 2008 Report Share Posted June 19, 2008 40 Tips for optimizing your php code Error suppression with @ is very slow. Link to comment Share on other sites More sharing options...
v3rb0 Posted June 19, 2008 Report Share Posted June 19, 2008 jā! pat pamēģināju pamērīt for($i=0; $i<10000; $i++) { @include('notexisting.file'); } ~27sec for($i=0; $i<10000; $i++) { if(file_exists('notexisting.file')) { include('notexisting.file'); } } ~5sec Link to comment Share on other sites More sharing options...
Ghenis Posted June 19, 2008 Report Share Posted June 19, 2008 Ja grib lietotājam rādīt smuku uzrakstu PHP kļūdas ziņojuma vietā, var uzrakstīt savu error handleri Link to comment Share on other sites More sharing options...
Recommended Posts