I do a check on the wareUrl , if the wareUrl already exists in the database, then I skip it.
My code is:
public function exists($item, $type) { return (bool)$this->sqlite->querySingle('SELECT COUNT(*) FROM `items` WHERE `type` = ' . $type . ' AND `wareUrl` = \'' . SQLite3::escapeString($item->wareUrl) . '\''); } Everything works, but if one wareUrl is set as http://site.ru , and the second http://site.ru/ - saves both options.
How to save a wareUrl before getting the address without a slash on the end?
Checking just domain will not work. the addresses can be of the form http://site.ru/1.html and http://site.ru/2.html , in this case both variants should be saved.
trim- terantrim($item->wareUrl, '/')so probably? - teran 2:58 pm